objcopy, ld and jumps
H. J. Lu
hjl@lucon.org
Fri Feb 2 14:26:00 GMT 2007
On Fri, Feb 02, 2007 at 09:37:00AM +0100, Stefan Reinauer wrote:
> Dear binutils developers,
>
> we're in the progress of building a new major version of LinuxBIOS, and
> I want to take the chance to get rid of some bad habits in the code.
>
> Well, the first thing that is required is the reset vector. It's 16
> bytes at 0xfffffff0 (aliased to f000:fff0 in real mode). It jumps into
> the real code which is placed at 0xffffe000 (0xe000 in the current segment).
>
> ld -Ttext 0xfffffff0 reset.o -o reset.elf
> objcopy -O binary -S reset.elf reset.bin
>
> Now I disassemble it:
>
> ndisasm -o 0xfffffff0 reset.bin | head -1
> FFFFFFF0 E9FEDF jmp 0xdff1
>
> Oops. It is obviously wrong. But why?
>
> Alternatively I omit the objcopy step but I basically do the same (do I?):
>
> ld -Ttext 0xfffffff0 -s --oformat binary reset.o -o reset.bin
>
> ndisasm -o 0xfffffff0 reset.bin | head -1
>
> FFFFFFF0 E90DE0 jmp 0xe000
>
> Phew. It works here. But why? What's the difference?
Please open a bug report.
H.J.
More information about the Binutils
mailing list