>>> "H. J. Lu" <[EMAIL PROTECTED]> 28.09.06 15:24 >>> >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.
Attached. The linker script likely is not minimal, but I think the important point is that it sets the origin to a non-zero value. Compiling this with gcc 4.1.1 (-c -fPIC) and linking with ld 2.17 (no other options than those necessary to specify input and output) succeeds, while linking with ld 2.15 fails (due to relocation overflow). But again, if this is plainly a linker bug, then the compiler also must not access weak objects through RIP-relative addressing (i.e. then we also have a compiler bug here), while I continue to think that the fact that there is a 'hidden' attribute should allow the compiler to do better than going through GOT (at the expense of a new relocation type). Jan
got.lds
Description: Binary data
got.c
Description: Binary data