Sometimes ld uses the default builtin loader script to set the origin of the text segment despite the commandline parameter -Ttext-segment=ORG. In particular: binutils-2.20.1 on OpenSolaris (SunOS opensolaris 5.11 snv_111b i86pc i386 i86pc Solaris) when configured and built to handle 64-bit binaries via "./configure --enable-64-bit-bfd=yes". -Ttext-segment fails for 64-bit, works for 32-bit.
Test case: -----start.s _start: .globl _start hlt ----- $ gcc -m32 -c -o start32.o start.s $ gcc -m64 -c -o start64.o start.s $ ld-2.20.1 -Ttext-segment=0x90000000 -o start32 start32.o $ readelf --segments start32 | grep LOAD LOAD 0x000000 0x90000000 0x90000000 0x00055 0x00055 R E 0x1000 ## WORKS because p_vaddr is 0x90000000, default is 0x08048000. $ ld-2.20.1 --oformat elf64-x86-64 -m elf_x86_64 -Ttext-segment=0x567000 -o start64 start64.o $ readelf --segments start64 | grep LOAD LOAD 0x0000000000000000 0x0000000000400000 0x0000000000400000 ### FAILS because p_vaddr is the default 0x400000, should be the specified 0x567000. -- Summary: "ld -Ttext-segment=ORG" does not set PT_LOAD.p_vaddr Product: binutils Version: 2.20 Status: NEW Severity: normal Priority: P2 Component: ld AssignedTo: unassigned at sources dot redhat dot com ReportedBy: jreiser at BitWagon dot com CC: bug-binutils at gnu dot org GCC build triplet: i386-pc-solaris2.11 GCC host triplet: i386-pc-solaris2.11 GCC target triplet: i386-pc-solaris2.11 http://sourceware.org/bugzilla/show_bug.cgi?id=11628 ------- You are receiving this mail because: ------- You are on the CC list for the bug, or are watching someone who is. _______________________________________________ bug-binutils mailing list bug-binutils@gnu.org http://lists.gnu.org/mailman/listinfo/bug-binutils