[GOLD] -Ttext does not relocate as expected
ryan
stdstack@gmail.com
Thu Mar 21 00:21:00 GMT 2013
Hi All,
Not sure whether this is a bug or not. When I'm writing a simple hello
world boot loader, I tried to relocate the text section to 0x7c00 for
convention. The assembly code is attached. I used the following
command to compile it:
> gcc -m32 -nostdinc -c -o boot.o boot.S
> ld -m elf_i386 -N -e start -Ttext 0x7c00 -o boot.out boot.o
> objdump -S boot.out > boot.asm
> ...
It doesn't work as expected. Then I checked boot.asm the actual start
address is 0x8c00 instead of 0x7c00.
> Disassembly of section .text:
> 00008c00 <start>:
> 8c00: fc cld
> 8c01: 31 c0 xor %eax,%eax
> ...
It took me a while to realize in my system, I replaced the default
`ld' with `ld.gold'. So `ld' in the above command is actually
`ld.gold'. After I changed it back to use the default `ld', the start
address become 7c00 as expected. Does anyone has a clue why it's like
this?
Here is my environment information:
OS: Ubuntu 12.04 64-bit
binutils version: 2.22
ld.gold: 1.11
gcc: 4.6
Thanks in advance!
Best regards,
Ryan
-------------- next part --------------
A non-text attachment was scrubbed...
Name: boot.S
Type: application/octet-stream
Size: 292 bytes
Desc: not available
URL: <https://sourceware.org/pipermail/binutils/attachments/20130321/972f871d/attachment.obj>
More information about the Binutils
mailing list