I wrote to Hohmuth about this, but he might be away or busy ...
http://os.inf.tu-dresden.de/fiasco/faq.html#5992 says:
[v0.5 981012] Build problem when building oskit/examples/multiboot-smp: "relocation truncated" I cannot reproduce this problem. However, as this binary isn't needed, you can work around this problem by "touch oskit/examples/multiboot-smp". (hohmuth 98/10/24)
I got exactly this error when I tried building Fiasco.
It was preceded by a warning coming from boot.S, which might be connected, so I'm copying the edited highlights below.
Does anyone with knowledge of x86 assembler understand this problem, and can they fix it?
How come it only affects some people? Is it caused by different versions of the assembler? Isn't the assembler part of gcc? I'm using standard gcc 2.7.2.3, so which other packages should I check the versions of? I'm using Debian's binutils version 2.9.1.0.19a-2, for example, as released with Debian 2.1.
I got the same assembler warning several times when building L4-Linux.
Edmund
gcc -c -MD -DHAVE_CONFIG_H -I. -I../libsmp/x86 -I- -I.. -I.. -I../flux/c -nostdinc -DASSEMBLER -MD ../libsmp/x86/boot.S /tmp/cca03216: Assembler messages: /tmp/cca03216:538: Warning: warning: missing prefix `*' in absolute indirect address, maybe misassembled! ... ... ... ld -Ttext 100000 -L../lib \ -o multiboot-smp ../lib/multiboot.o multiboot-smp.o \ -lsmp -lkern -lmc -llmm ../lib/crtn.o ../lib/libsmp.a(boot.o): In function `_SMP_TRAMP_START_': boot.o(.text+0x29): relocation truncated to fit: R_386_16 _SMP_TRAMP_32_ENTRY_ make[2]: *** [multiboot-smp] Error 1 make[2]: Leaving directory `/usr/local/tmp/L4/l4/oskit/examples' make[1]: *** [examples/all.MAKE] Error 2 make[1]: Leaving directory `/usr/local/tmp/L4/l4/oskit' make: *** [oskit] Error 2
From: edmundo@rano.demon.co.uk Subject: "relocation truncated" Date: Sun, 14 Mar 1999 12:48:47 +0000
Does anyone with knowledge of x86 assembler understand this problem, and can they fix it?
l4-oskit is rather old version of OSKit, and more recent version can be compiled without such a error. I haven't compiled Fiasco with oskit-0.97, but that will be fine, perhaps. The latest version is available from the home page of the Flux Research Group, http://www.cs.utah.edu/projects/flexmach/.
---------------------------------------------------------------------- OKUJI Yoshinori okuji@kuicr.kyoto-u.ac.jp ^o-o^ http://duff.kuicr.kyoto-u.ac.jp/~okuji (in English) m /
As usually happens, I have some ideas of my own straight after posting. Without actually understanding any of this, I have done some experiments (randomly commenting out bits of assembler and seeing what happens) and have discovered:
The "Warning: warning: missing prefix `*' in absolute indirect address, maybe misassembled!" probably doesn't matter, but I can make it go away by changing
call (%eax)
to:
call *(%eax)
The perhaps serious error "relocation truncated to fit" is caused by this line:
ljmp $KERNEL_CS, $EXT(_SMP_TRAMP_32_ENTRY_)
I can make it go away by moving the .code32 directive to the other side of it, i.e. replacing
/* now go to 32-bit segment */ ljmp $KERNEL_CS, $EXT(_SMP_TRAMP_32_ENTRY_)
.code32
by:
.code32
/* now go to 32-bit segment */ ljmp $KERNEL_CS, $EXT(_SMP_TRAMP_32_ENTRY_)
This change may be a good one, because the there's comment immediately following that says:
* [_SMP_TRAMP_32_ENTRY_ - 6] is the 32 bit address of the ljmp destination.
My empirical measurements indicate that the ljmp instruction takes only 5 bytes in 16-bit mode, but 7 bytes in 32-bit mode.
All this in oskit/libsmp/x86/boot.S, so it may not be totally relevant to L4 hackers ...
Edmund
I can make it go away by moving the .code32 directive to the other side of it, i.e. replacing
/* now go to 32-bit segment */ ljmp $KERNEL_CS, $EXT(_SMP_TRAMP_32_ENTRY_)
.code32
by:
.code32
/* now go to 32-bit segment */ ljmp $KERNEL_CS, $EXT(_SMP_TRAMP_32_ENTRY_)
U shouldn't do that ! The problem is that you're still running in a 16bit segment, but you're about to jump into a 32-bit segment. So this should stay in the .code16 part and the output should look like
.byte 0x67, 0x66, 0xea .long address .word code-segment
Seb.
l4-hackers@os.inf.tu-dresden.de