binutils + 16-bit code issues
Alan Modra
amodra@gmail.com
Mon Sep 25 01:38:00 GMT 2017
On Fri, Sep 22, 2017 at 05:04:53PM -0700, Anatol Pomozov wrote:
> $ as boot.S -o boot.o
> $ ld boot.o -o boot --oformat binary
> boot.o: In function `_start':
> (.text+0x5): relocation truncated to fit: R_X86_64_16 against `.text'+28
> boot.o: In function `_start':
> (.text+0x12): relocation truncated to fit: R_X86_64_16 against `.text'+32
>
> Unfortunately the error message does not make it easy for me to
> understand what is going on here. And how to fix the error. After
You are using a linker that by default produces binaries to run on a
Linux system, so for x86_64 they start at around 0x400000. ".text+28"
is way out of the range of a 16-bit reloc. You probably want your
binary to be linked at address zero. The best way to do that is to
write a small linker script. See the ld info doc for examples.
--
Alan Modra
Australia Development Lab, IBM
More information about the Binutils
mailing list