[Gc] "relocation truncated to fit" link error

David Jones dej at inode.org
Mon Apr 4 04:24:05 PDT 2005

On April 3, 2005 05:17 pm, Dan Bonachea wrote:
> Has anybody seen this link error before?:
> gc.a(os_dep.o)(.text+0xac1): In function `GC_init_linux_data_start':
> os_dep.c:350: relocation truncated to fit: GPREL22 _end
> gc.a(os_dep.o)(.text+0x1220): In function `GC_register_data_segments':
> os_dep.c:1442: relocation truncated to fit: GPREL22 _end

This happens because the compiler has placed an offset to data in a 22-bit 
immediate field of an instruction.  During linking, the linker must update 
the offset to its final value, which overflows the 22 bits.

Basically, an assumption made by the compiler is broken.  You must take a 
word-around to eliminate the message.

More information about the Gc mailing list