Ok it could be problem with binutils/gcc. But in general this problem will occurs if size of data and bss section is big enough, so gp can not be set on proper place. If we have large project (mixed c and c++, linked with libstdc++, libsupc++) and if we compiled project source with -mlong-calls and -G0 in this case problem with MIPS_GPREL_16 only occurs on functions from gcc library (libstdc++, liblsupc++), because this libraries are not compiled with -mlong-calls and -G0?
If my conclusion is correct, is it possible to rebuild this libraries with -mlong-calls and -G0 option? Best regards Mile On Tue, 2005-03-22 at 13:21 +0100, Mile Davidovic wrote: > Hello all > I am using gcc for MIPS ( 3.3.x, target mips-elf). > I had problem during linking, (MIPS_GPREL_16 relocation truncated to > fit error occurs). > I set value of gp registers to appropriate value and used -mlong-calls > and -G0 switch to prevent this problem. > > However problem arise again depending on section size (bss, sbss, > data, sdata). Every time that heppends I have to move gp again. I > believe that this reloation is used in gcc libraries (libgcc, stdc++, > ...). Is that any chance these libraries to be build without mention > relocation? You could also try upgrading your gcc and binutils. Without a testcase I'm not certain what's happening, but we've fixed a number of problems with such over the years.