On 28/9/06 14:24, "H. J. Lu" <[EMAIL PROTECTED]> wrote: > On Thu, Sep 28, 2006 at 10:45:38AM +0100, Jan Beulich wrote: >> >> 2) Why does the linker silently resolve the (32-bit PC-relative) >> relocation targeting an undefined weak symbol, yielding at >> run-time a non-zero address? While I can see the point of > > Do you have a testcase? I can't reproduce it. If it is true, I consider > it a linker bug.
Compile and link the attached C program as follows. I used gcc-4.1.1 and binutils-2.17, but gcc >= 4.0.0 and binutils >= 2.16 probably suffice. # gcc -fpic -o test.o -c test.c # ld -Ttext 100000000 -o test test.o Disassembly of the result trivially shows that the address of weak symbol 'x' is 0x100000000. -- Keir
test.c
Description: Binary data