This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Linking very large application with GCC trunk on powerpc-linux leads to relocation error of crtbegin/end.o


On Mon, Jun 16, 2008 at 01:27:58PM +0200, Laurent GUERBY wrote:
> Hi,
> 
> When linking a very large (> 100MB executable) application on
> powerpc-linux with trunk we get linker errors:
> 
> .../lib/gcc/powerpc-unknown-linux-gnu/4.4.0/crtbegin.o:(.fini+0x0):
> relocation truncated to fit: R_PPC_REL24 against `.text'
> .../lib/gcc/powerpc-unknown-linux-gnu/4.4.0/crtend.o:(.init+0x0):
> relocation truncated to fit: R_PPC_REL24 against `.text' 
> 
> The application itself is compiled with -mlongcall,
> would adding -mlongcall to crtstuff.c Makefile rule help here?

It ought to.  You could also try GNU ld's --relax option, which might
also allow you to dispense with -mlongcall for your app.

> If no, what is the proper solution GCC-wise?

I'll note that this problem is exacerbated by the fact that crtbegin.o
defines the destructor function run from .fini and crtend.o defines
the constructor run from .init.  It really should be the other way
around, since this arrangement results in maximmum offset branches,
from the .init section located before .text to a function at the end
of .text, and from the .fini section located after .text to a function
at the beginning of .text.

-- 
Alan Modra
Australia Development Lab, IBM


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]