[uClinux-dev] C++, IOStreams, relocation truncated to fit

David McCullough davidm at snapgear.com
Tue Nov 20 19:34:56 EST 2001


Jivin Ken Treis lays it down ...
> Hello all,
> 
> I've been hesitant to ask this because it's probably a FAQ, but I can't 
> seem to find the answer anywhere.  If it's a RTFM, please point me at 
> the Fine Materials.  :)
> 
> We've succeeded in compiling a C++ app for uClinux, and it worked fine 
> until we started using IOStreams.  Now we get compilation errors that 
> are reminescent of the old coff compiler problems with "relocation 
> truncated to fit".  However, all info that I've found about this 
> particular problem seems to suggest that the ELF toolchain will fix the 
> problem.  I'm using the latest m68k-elf tools (20010716), so I don't 
> feel that I can rightly blame the compiler. Perhaps it's something that 
> I'm doing wrong with the CFLAGS, or perhaps IOStreams just don't work 
> quite right under uClinux.
> 
> Here's the output, and any insights are greatly appreciated.  TIA.


First problem is you should be using "-fPIC",  you should use "-msep-data"
for XIP under uClinux.

Also,  m68k PIC cannot do the impossible.  If you have a function that
requires branches that are too big for the M68K relative branch,  you
cannot compile it PIC.  Luckily,  it doesn't have to be PIC to use it.
Just remove the '-msep-data' option from your build and you will get
a fully relocated/no size limit version of the binary that can do anything
except of course XIP ;-)

So try -msep-data first,  then if you still get this error,  remove the
-msep-data option completely,


Cheers,
Davidm



> m68k-elf-g++ -Os -g -fomit-frame-pointer  -Dlinux -D__linux__ -Dunix 
> -D__uClinux__ -DEMBED -I~/coldfire/uClinux/lib//include 
> -I~/coldfire/uClinux/lib/libm -I~/coldfire/uClinux -fno-builtin 
> -msep-data -I~/coldfire/uClinux//include  -fname-mangling-version-0 
> -ansi -I../../CppTestKit -g -Wall -fPIC -m5307 -D__uClinux__ 
> -Wl,-elf2flt DataDestination.o FrameBuffer.o Image.o ImageSource.o 
> Normalizer.o Pixel.o RealNormalizer.o SimulatedNormalizer.o 
> AssertImagesEqual.o NormalizerTest.o -L. -o test 
> ../../CppTestKit/coldfire/DumbConsole.o 
> ../../CppTestKit/coldfire/libTkCore.a -lc -lgcc
> test.elf2flt: In function `_IO_fclose':
> /home/davidm/work/m68k-elf-tools/m68k-elf-gcc/m68k-elf/m5307/msep-data/libio/../../../../../gcc-2.95.3/libio/iofclose.c:54: 
> relocation truncated to fit: R_68K_PC16 __cmpdf2
> /home/davidm/work/m68k-elf-tools/m68k-elf-gcc/m68k-elf/m5307/msep-data/libio/../../../../../gcc-2.95.3/libio/iofclose.c:54: 
> relocation truncated to fit: R_68K_PC16 __cmpdf2
> /home/davidm/work/m68k-elf-tools/m68k-elf-gcc/m68k-elf/m5307/msep-data/libio/../../../../../gcc-2.95.3/libio/iofclose.c:54: 
> relocation truncated to fit: R_68K_PC16 __cmpdf2
> test.elf2flt: In function `__muldi3':
> /home/davidm/work/m68k-elf-tools/m68k-elf-gcc/gcc/../../gcc-2.95.3/gcc/libgcc2.c(.text+0x150e2): 
> relocation truncated to fit: R_68K_PC16 __cmpdf2
> collect2: ld returned 1 exit status
> make: *** [test] Error 1
> 
> -- 
> Ken Treis / Software Engineer
> Key Technology, Inc.
> ktreis at keyww.com
> ----
> America will not reject abortion until America sees abortion.
> http://www.priestsforlife.org/resources/abortionimages/index.htm
> 
> 
> This message resent by the uclinux-dev at uclinux.org list server http://www.uClinux.org/

-- 
David McCullough:    Ph: +61 7 3435 2815  http://www.SnapGear.com
davidm at snapgear.com  Fx: +61 7 3891 3630  825 Stanley St., W'gabba QLD 4102, Oz
This message resent by the uclinux-dev at uclinux.org list server http://www.uClinux.org/



More information about the uClinux-dev mailing list