[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bfd: GLOBAL HIDDEN reloc zeroed out when -lc
From: |
John Reiser |
Subject: |
bfd: GLOBAL HIDDEN reloc zeroed out when -lc |
Date: |
Thu, 31 May 2001 20:11:11 -0700 |
Hi,
version: both binutils-2.11 and binutils-2.10.1, on i686-pc-linux-gnu.
Running "ld-new -m elf_i386 -o foo.so crtbeginS.o"
correctly relocates the R_386_GOT32 reference and R_386_32
target datum __dso_handle (which points to itself) of
routine __do_global_dtors_aux .
Running "ld-new -m elf_i386 -o foo.so crtbeginS.o -lc"
(same except for "-lc") results in __dso_handle containing zero,
and leaving a R_386_NONE relocation in .rel.got.
The NONE relocation is harmless, but perhaps symptomatic.
__dso_handle containing 0 is a bug.
crtbeginS.o is commonly found in /usr/lib/gcc-lib/<platform>/<release> ;
I attach a .tar.gz copy of mine. Yes, there is no "-shared" parameter.
This is somewhat unusual, but the R_386_32 relocation still should work.
Here is my diagnostic info:
$ readelf --all crtbeginS.o
...
Relocation section '.rel.text' at offset 0x7d4 contains 17 entries:
Offset Info Type Symbol's Value Symbol's Name
...
0000002c 01803 R_386_GOT32 00000000 __dso_handle
...
Relocation section '.rel.data' at offset 0x85c contains 2 entries:
Offset Info Type Symbol's Value Symbol's Name
00000000 01801 R_386_32 00000000 __dso_handle
...
Symbol table '.symtab' contains 29 entries:
Num: Value Size Type Bind Vis Ndx Name
...
24: 00000000 0 OBJECT GLOBAL HIDDEN 3 __dso_handle
...
-----without -lc; relocation OK
$ ld-new -m elf_i386 -o foo.so crtbeginS.o
$ gdb foo.so
(gdb) x/14i __do_global_dtors_aux
0x8048084 <__do_global_dtors_aux>: push %ebp
0x8048085 <__do_global_dtors_aux+1>: mov %esp,%ebp
0x8048087 <__do_global_dtors_aux+3>: push %ebx
0x8048088 <__do_global_dtors_aux+4>: sub $0x4,%esp
0x804808b <__do_global_dtors_aux+7>: call 0x8048080
0x8048090 <__do_global_dtors_aux+12>: add $0x1104,%ebx
0x8048096 <__do_global_dtors_aux+18>: mov 0xfffffff4(%ebx),%eax
0x804809c <__do_global_dtors_aux+24>: test %eax,%eax
0x804809e <__do_global_dtors_aux+26>:
jne 0x804810e <__do_global_dtors_aux+138>
0x80480a0 <__do_global_dtors_aux+28>: mov 0xc(%ebx),%ecx
0x80480a6 <__do_global_dtors_aux+34>: test %ecx,%ecx
0x80480a8 <__do_global_dtors_aux+36>:
je 0x80480be <__do_global_dtors_aux+58>
0x80480aa <__do_global_dtors_aux+38>: mov 0x10(%ebx),%eax # %eax is OK
0x80480b0 <__do_global_dtors_aux+44>: sub $0xc,%esp
(gdb) x/x 0x8048090+0x1104+0x10
0x80491a4 <_GLOBAL_OFFSET_TABLE_+16>: 0x08049180 # value loaded ino %eax
-----
-----with -lc; relocated datum is zero
$ ld-new -m elf_i386 -o foo.so crtbeginS.o -lc
$ gdb foo.so
(gdb) x/14i __do_global_dtors_aux
0x8048274 <__do_global_dtors_aux>: push %ebp
0x8048275 <__do_global_dtors_aux+1>: mov %esp,%ebp
0x8048277 <__do_global_dtors_aux+3>: push %ebx
0x8048278 <__do_global_dtors_aux+4>: sub $0x4,%esp
0x804827b <__do_global_dtors_aux+7>: call 0x8048270 <__cxa_finalize+28>
0x8048280 <__do_global_dtors_aux+12>: add $0x1104,%ebx
0x8048286 <__do_global_dtors_aux+18>: mov 0xfffffff4(%ebx),%eax
0x804828c <__do_global_dtors_aux+24>: test %eax,%eax
0x804828e <__do_global_dtors_aux+26>:
jne 0x80482fe <__do_global_dtors_aux+138>
0x8048290 <__do_global_dtors_aux+28>: mov 0x24(%ebx),%ecx
0x8048296 <__do_global_dtors_aux+34>: test %ecx,%ecx
0x8048298 <__do_global_dtors_aux+36>:
je 0x80482ae <__do_global_dtors_aux+58>
0x804829a <__do_global_dtors_aux+38>: mov 0x1c(%ebx),%eax # %eax is 0;
<<bug>>
0x80482a0 <__do_global_dtors_aux+44>: sub $0xc,%esp
(gdb) x/x 0x8048280+0x1104+0x1c
0x80493a0 <_GLOBAL_OFFSET_TABLE_+28>: 0x00000000 # value loaded into %eax
-----
--
John Reiser, address@hidden
crtbeginS.tar.gz
Description: Binary data
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- bfd: GLOBAL HIDDEN reloc zeroed out when -lc,
John Reiser <=