[uClibc]BINFMT_FLAT bad magic, elf2flt 'input file contains no relocation info' m68k
Syed Faisal Akber
faisal at AKBER.NET
Tue Jan 14 04:24:34 UTC 2003
Brad,
There seem to be a lot of variables that you are playing with to get your
stuff to compile. Here's what you need to start off with.
With the tool-chain you are using ALWAYS use -msep-data, this ensures that
the "data" section of file is relocatable.
ONLY use -Wl,-elf2flt at the final link stage, never at any intermediate
link stage, such as library generation.
I noticed that you used the option -export-dynamic. For the most part,
you usually want to use -export-dynamic when you are creating dynamically
linked libraries. For most setups you want to link statically. So do not
use the -export-dynamic option. (Dynamic linking is possible, but stick
to the simpler method for now, until you have more success.)
Also what DavidM told you to use for command-line options are correct.
The error you get when you use what he tells you is an installation
problem. I assume that you are using a pre-built binary package for this
tool-chain. Even so, some files may have been modified or corrupted.
Inspect /usr/local/m68k-elf/bin/ld and /usr/local/bin/m68k-elf-ld. These
are actually shell scripts that call the real linker (which would be
renamed as ld.real and m68k-elf-ld.real). It seems that this script may
be messed up.
Be sure to check the directory /usr/local/m68k-elf/lib and make sure that
it is a directory that contains the uclibc libraries and other libraries.
This is the source of your last problems.
Good luck,
Faisal
On Mon, 13 Jan 2003, Brad Clements wrote:
> On 13 Jan 2003 at 17:44, Phil Wilshire wrote:
>
> > > 2. elf2flt doesn't work, is that because i'm not using PIC?
> > you may need -msep-data as a compile option
>
> ahh.
>
> > Really close and almost a cigar
> >
> > remind me again the compiler you are using please..
>
> [bkc at marimba m68k-python]$ gcc -v
> Invoked as gcc
> arg[ 0] = /usr/local/bin/m68k-elf-gcc
> arg[ 1] = -v
> Reading specs from /usr/local/lib/gcc-lib/m68k-elf/2.95.3/specs
> gcc version 2.95.3 20010315 (release)(ColdFire patches - 20010318 from http://fiddes.net/coldfire/)(-msep-data patches)
>
>
> 1. I added -msep-data to extra/Config/Config.m68k ARCH_CFLAGS, then rebuild
> uClibc with PIC enabled, and I still got "relocation truncated to fit" errors.
>
> 2. rebuild without PIC, but leave -msep-data in there.
>
> 3. edit Python makefile to add -elf2flt to LDFLAGS and -msep-data to CFLAGS
>
> gcc -c -DNDEBUG -g -O3 -Wall -Wstrict-prototypes -msep-data -I. -I/usr/local/src/python-cvs/python/dist/src/Include -DPy_BUILD_CORE -o Objects/typeobject.o /usr/local/src/python-cvs/python/dist/src/Objects/typeobject.c
> In file included from /usr/local/src/python-cvs/python/dist/src/Include/Python.h:39,
> from /usr/local/src/python-cvs/python/dist/src/Objects/typeobject.c:3:
> /var/local/src/m68k-linux-uclibc/include/unistd.h:247: warning: empty declaration
> In file included from /usr/local/src/python-cvs/python/dist/src/Include/Python.h:48,
> from /usr/local/src/python-cvs/python/dist/src/Objects/typeobject.c:3:
> /usr/local/src/python-cvs/python/dist/src/Include/pyport.h:360: warning: `struct winsize' declared inside parameter list
> /usr/local/src/python-cvs/python/dist/src/Include/pyport.h:360: warning: its scope is only this definition or declaration, which is probably not what you want.
> /usr/local/src/python-cvs/python/dist/src/Include/pyport.h:361: warning: `struct winsize' declared inside parameter list
> /tmp/cc0403Pk.s: Assembler messages:
> /tmp/cc0403Pk.s:30347: Error: value out of range
> /tmp/cc0403Pk.s:30442: Error: value out of range
> /tmp/cc0403Pk.s:30468: Error: value out of range
> /tmp/cc0403Pk.s:30496: Error: value out of range
> /tmp/cc0403Pk.s:30533: Error: value out of range
> /tmp/cc0403Pk.s:30547: Error: value out of range
> /tmp/cc0403Pk.s:30622: Error: value out of range
> /tmp/cc0403Pk.s:30637: Error: value out of range
> /tmp/cc0403Pk.s:30699: Error: value out of range
> /tmp/cc0403Pk.s:30725: Error: value out of range
> /tmp/cc0403Pk.s:30751: Error: value out of range
> /tmp/cc0403Pk.s:30788: Error: value out of range
> /tmp/cc0403Pk.s:30802: Error: value out of range
> /tmp/cc0403Pk.s:30893: Error: value out of range
> /tmp/cc0403Pk.s:30933: Error: value out of range
> /tmp/cc0403Pk.s:30957: Error: value out of range
> /tmp/cc0403Pk.s:30981: Error: value out of range
> /tmp/cc0403Pk.s:31005: Error: value out of range
> /tmp/cc0403Pk.s:31029: Error: value out of range
> /tmp/cc0403Pk.s:31053: Error: value out of range
> /tmp/cc0403Pk.s:31077: Error: value out of range
>
> <snip>
>
> I suppose this is due to -msep-data
>
> 4. remove -msep-data from python make file and make again
>
> ranlib libpython2.3.a
> c++ -elf2flt -Xlinker -export-dynamic -o python \
> Modules/python.o \
> libpython2.3.a -lpthread -lutil -lm
> /var/local/src/m68k-linux-uclibc/lib: file not recognized: Is a directory
> collect2: ld returned 1 exit status
>
> this is why I started playing around with hand elf2flt..
>
> 5. ld -elf2flt -o python Modules/python.o libpython2.3.a -lpthread -lutil -lm -lc
>
> produces:
>
> usr/local/src/python-cvs/python/dist/src/Python/structmember.c:164: relocation truncated to fit: R_68K_PLT16 __rpc_thread_variables
> /usr/local/src/python-cvs/python/dist/src/Python/structmember.c:164: relocation truncated to fit: R_68K_PLT16 __rpc_thread_variables
> /usr/local/src/python-cvs/python/dist/src/Python/structmember.c:164: relocation truncated to fit: R_68K_PLT16 sprintf
> /usr/local/src/python-cvs/python/dist/src/Python/structmember.c:164: relocation truncated to fit: R_68K_PLT16 strcpy
> /usr/local/src/python-cvs/python/dist/src/Python/structmember.c:164: relocation truncated to fit: R_68K_PLT16 strlen
> /usr/local/src/python-cvs/python/dist/src/Python/structmember.c:164: relocation truncated to fit: R_68K_PLT16 sprintf
> /usr/local/src/python-cvs/python/dist/src/Python/structmember.c:164: relocation truncated to fit: R_68K_PLT16 strcpy
> /usr/local/src/python-cvs/python/dist/src/Python/structmember.c:164: relocation truncated to fit: R_68K_PLT16 strlen
> /usr/local/src/python-cvs/python/dist/src/Python/structmember.c:164: relocation truncated to fit: R_68K_PLT16 strcpy
> /usr/local/src/python-cvs/python/dist/src/Python/structmember.c:164: relocation truncated to fit: R_68K_PLT16 strlen
>
> <snip>
>
> Perhaps this is due to NOT having -msep-data
>
> 6. also tried David's suggestion:
>
> cc -Wl -elf2flt -o python Modules/python.o libpython2.3.a -lpthread -lutil -lm -lc
> /var/local/src/m68k-linux-uclibc/lib: file not recognized: Is a directory
> collect2: ld returned 1 exit status
>
>
> strange..
>
> Clearly I'm missing a clue here.
>
> A while back I was able to compile the user/python dist for emulation under xcopilot,
> now that I have real hardware I can't get anywhere.
>
>
>
> --
> Brad Clements, bkc at murkworks.com (315)268-1000
> http://www.murkworks.com (315)268-9812 Fax
> http://www.wecanstopspam.org/ AOL-IM: BKClements
>
> _______________________________________________
> uClibc mailing list
> uClibc at uclibc.org
> http://uclibc.org/mailman/listinfo/uclibc
>
>
More information about the uClibc
mailing list