[Gc] "relocation truncated to fit" link error

Boehm, Hans hans.boehm at hp.com
Mon Apr 4 16:41:04 PDT 2005

Dan -

David is right that a reference to _end seems to require too large
a displacement from the global offset table.  But, especially in
the case of gctest, it sounds to me like something here is broken.
There aren't nearly enough symbols (by a few orders of magnitude)
to legitimately cause this problem.

I can't reproduce the problem with GNU ld version 2.5 and gcc 3.3.4.
Which version of ld are you using?  The second ChangeSet
description in https://www.gelato.unsw.edu.au/linux-ia64/0406/9938.html
suggests that a similar problem isn't unheard of with 2.14.90, but
I don't know whether this is the same issue.


> -----Original Message-----
> From: gc-bounces at napali.hpl.hp.com 
> [mailto:gc-bounces at napali.hpl.hp.com] On Behalf Of Dan Bonachea
> Sent: Sunday, April 03, 2005 2:17 PM
> To: gc at napali.hpl.hp.com
> Subject: [Gc] "relocation truncated to fit" link error
> 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
> I'm seeing it on Itanium/Linux2.4.21 when linking the static 
> collector library 
> (libgc.a) into executables using gcc-3.3.3 or gcc-3.4.3. I'm 
> not even certain 
> what the error means - is the collector sometimes limited to 
> 22 bits (4MB) of 
> static data?
> The link error occurs even on gctest built from a clean 
> configure with the 
> default options, if the link command is changed to use 
> libgc.a instead of 
> libgc.so. These link errors on gctest disappear if the 
> collector is configured 
> with --disable-shared, but they come right back if you add 
> this line to the 
> top of test.c (to artificially inflate the static data to 
> "real program" 
> size):
>     char pad[8*1024*1024];
> I've tried many different linker options, and nothing seems 
> to help - the only 
> thing that reliably makes it go away is a fully static link 
> (gcc -static), but 
> that brings a whole host of other problems and is often impractical.
> Ideas are appreciated...
> Dan
> _______________________________________________
> Gc mailing list
> Gc at linux.hpl.hp.com 
> https://www.hpl.hp.com/hosted/linux/mail-archives/gc/

More information about the Gc mailing list