Re: problem compiling kernel ld error relocation truncated to fit: GPREL16 against symbol
[Added linux-alpha to CC to increase likelihood of reaching someone who
best knows about this issue.]
On 03/11/11 15:54, carl hansen wrote:
> Problem compiling kernel 3.1, gcc 4.6.1 or .2, latest binutils
>
> I think it's ld error
> google suggested -Wl,--no-relax, didn't make a difference, unless I
> did it wrong
The binutils bug that can be worked around with --no-relax is not the
issue here.
> ld -static -N --build-id -o .tmp_vmlinux1 -T
> arch/alpha/kernel/vmlinux.lds arch/alpha/kernel/head.o
> init/built-in.o --start-group usr/built-in.o
> arch/alpha/kernel/built-in.o arch/alpha/mm/built-in.o
> arch/alpha/math-emu/built-in.o kernel/built-in.o mm/built-in.o
> fs/built-in.o ipc/built-in.o security/built-in.o crypto/built-in.o
> block/built-in.o lib/lib.a arch/alpha/lib/lib.a lib/built-in.o
> arch/alpha/lib/built-in.o drivers/built-in.o sound/built-in.o
> firmware/built-in.o net/built-in.o --end-group
> init/built-in.o: In function `do_one_initcall':
> /var/src.build/kernelbuild/latest/linux-3.1/init/main.c:682:(.text+0x8):
> relocation truncated to fit: GPREL16 against symbol `initcall_debug'
> defined in .sbss section in init/built-in.o
Confirmed. Building kernel 3.1 with config for Miata and mainly only
drivers needed for that hardware compiles fine with gcc-4.4 but fails
with the GPREL16 link errors when compiled with gcc-4.6.
If I modify arch/kernel/Makefile to add -mlarge-data rather than
-msmall-data to CFLAGS then the kernel successfully compiles with gcc-4.6.
Is there anyone more knowledgeable than I about gcc who can give us
guidance as to why gcc-4.6 should be enlarging the data segment so much
that the small data model cannot be used? Or is there a fix required in
the kernel code?
Cheers
Michael.
Reply to: