This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
hppa64-hp-hpux11.00: HP ELF64 brokeness (incorrect .dynamic section)
- From: ross dot alexander at uk dot neceur dot com
- To: binutils at sources dot redhat dot com
- Date: Fri, 28 Jun 2002 20:07:46 +0100
- Subject: hppa64-hp-hpux11.00: HP ELF64 brokeness (incorrect .dynamic section)
HI all,
There is a major bug with HP ld produced shared libraries.
ralexand@styx 19:53:36 $/usr/ccs/bin/ld -b -o libtest2.sl test2.o
libtest1.sl +b $PWD
ralexand@styx 19:53:39 $readelf -W -S libtest2.sl | more
There are 24 section headers, starting at offset 0x1448:
Section Headers:
[Nr] Name Type Address Off Size ES
Flg Lk Inf Al
[ 0] NULL 0000000000000000 ffffffffffffffff
000000 00 0 0 0
[ 1] .dynamic DYNAMIC 40000000000001c8 0001c8 000140 10
A 0 0 8
[ 2] .dynsym DYNSYM 4000000000000308 000308 0000a8 18
A 3 0 8
[ 3] .dynstr STRTAB 40000000000003b0 0003b0 00005e 00
A 0 0 1
[ 4] .hash HASH 4000000000000410 000410 000030 00
A 0 0 8
As you can see in the .dynamic section, the link is set to 0. This means
bfd_elf_get_bfd_needed_list breaks.
1569: shlink = elf_elfsections (abfd)[elfsec]->sh_link;
There are two solutions.
1) Check if shlink == 0 and pick up the ELF index of dynsym section
explicitly.
This does work but could break lots of other implementations.
2) Get HP to fix their linker. On page 9 of ELF-64 Object File Fromat,
V1.4 is
states the sh_link of SHT_DYNAMIC is "String table used by entries in this
section".
The problem is even if this gets fixed the existing HP libraries (eg X11 et
al) are
all broken.
Boo hoo,
Ross
---------------------------------------------------------------------------------
Ross Alexander "He knows no more about his
MIS - NEC Europe Limited destiny than a tea leaf knows
Work ph: +44 20 8752 3394 the history of East India Company"