This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: objcopy, ld and jumps
- From: "H. J. Lu" <hjl at lucon dot org>
- To: Stefan Reinauer <stefan dot reinauer at coresystems dot de>
- Cc: binutils at sourceware dot org
- Date: Fri, 2 Feb 2007 06:15:02 -0800
- Subject: Re: objcopy, ld and jumps
- References: <45C2F82C.3040904@coresystems.de>
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.