> 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.
By the way, experimentation with the address of the text section shows that the weak symbol's address is resolved to the nearest 4GB-aligned address (nearest to what I'm not sure -- RIP? Section start?). It may get rounded up or down, whichever is nearest. -- Keir