[Gc] "relocation truncated to fit" link error
bonachea at cs.berkeley.edu
Tue Apr 5 02:19:29 PDT 2005
I've verified that this is not a compiler bug - it in fact appears to be a bug
in the ia64 linker (ld).
The "relocation truncated to fit" error is coming from ld 2.14:
GNU ld version 188.8.131.52.4 20030523
but when I run the link (using the same exact object files!) using ld 2.15:
GNU ld version 184.108.40.206.2 20040927
there is no link error and everything works beautifully for both gctest (which
passes at runtime) and my original application. I suspect the older ld is
somehow botching the way it handles the "special" dynamic symbol _end (which
after all is probably very rarely used in programs other than the garbage
If I understand the issue correctly, the 22-bit limit is on the size of the
per-object symbol relocation table (which is constructed in response to
external dynamic symbols referenced by the current object) - so 22 bits of
table is enough for a given any given object to reference hundreds of
thousands of symbols, a limit that seems unlikely to ever be exceeded (so it
should never be a problem in practice).
At 04:41 PM 4/4/2005, Boehm, Hans wrote:
>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/
>Gc mailing list
>Gc at linux.hpl.hp.com
More information about the Gc