This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
Other format: | [Raw text] |
On 28/9/06 14:24, "H. J. Lu" <hjl@lucon.org> 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
Attachment:
test.c
Description: Binary data
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |