[uClinux-dev] M68k porting trouble: reloc error

Gavin Lambert gavinl at compacsort.com
Mon Aug 1 18:14:40 EDT 2005

(Resent because it didn't seem to make it the first time)

Slightly weird problem :)  Probably because I'm still a newbie.

I've got a fairly large program (final flat binary around 460kb) using
C++ and STL on a m5272.  Or at least trying to.

Compiling the main uclinux dist seemed to work ok (I've got a shell),
but I'm having trouble porting this program.

I keep getting errors like the following:
  BINFMT_FLAT: reloc outside program 0x70d5000 (0 - 0xffe95b14/0x62520),
killing testApp!

My current link line is as follows:
  m68k-elf-gcc -m5307 -DCONFIG_COLDFIRE -O1 -g -fno-common -Wall -Dlinux
-D__linux__ -Dunix -D__uClinux__ -DEMBED -fno-builtin -msep-data
-Wl,-elf2flt -o testApp testApp.eo ../testLib/libtestLib.a
../testCore/libtestCore.ea -lstdc++

An example compile line is like so:
  m68k-elf-g++ -m5307 -DCONFIG_COLDFIRE -c -O1 -g -fno-common -Wall
-Dlinux -D__linux__ -Dunix -D__uClinux__ -DEMBED -fno-builtin -msep-data
-I../testLib -I../testCore -o testApp.eo testApp.cpp

There aren't any errors during compile/link.  I'm using the 3.4.0
binaries (compiled for RedHat 7.2 host, though I'm actually on Ubuntu)
of the toolchain.

Every so often (after a clean rebuild), the app will start up instead of
displaying that error message, but it acts weird.  (Global variables
aren't initialized properly, only some of main() seems to run, etc.)

The output of flthdr is as follows:
   Magic:       bFLT
   Rev:         4
   Build Date:  Mon Aug  1 19:22:52 2005
   Entry:       0x48
   Data Start:  0x62560
   Data End:    0x70d90
   BSS End:     0x780b0
   Stack Size:  0x1000
   Reloc Start: 0x70d90
   Reloc Count: 0x54a
   Flags:       0x2 ( Has-PIC-GOT )

The app runs fine under native Linux.  Does anybody know how I can get
this working properly?

(and yes, I tried linking it to STLport and uClibc as well.  That had
similar results.)

More information about the uClinux-dev mailing list