[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: [microblaze-uclinux] Building microblaze toolchain



Hi John,

I was able to build elf2flt on with MinGW finally.  The binary is indeed
recognized by uClinux but the loader reports that there is a relocation
outside the program!  Do you have any ideas?  The ld-elf2flt output is
below.  I'm linking against the crt0.o and libc.a of uClib, and the
libgcc.a and libc_hard_shift.a from EDK.  The loader script is the
default elf2flt.ld from the elf2flt on uclinux.org.

C:\\Impulse\\CoDeveloper\\/uClinux/elf2flt/ld-elf2flt -v -Os -g -elf2flt
-LC:\\Impulse\\CoDeveloper\\/uClinux/lib/uClibc/lib -o mand mand_sw.o
co_init.o co_stream.o co_signal.o co_register.o co_memory.o co_process.o
co_type.o C:\\Impulse\\CoDeveloper\\/uClinux/lib/uClibc/lib/crt0.o -lc
C:\EDK\/gnu/microblaze/nt/lib/gcc-lib/microblaze/2.95.3-4/libgcc.a
C:\EDK\/gnu/microblaze/nt/microblaze/lib/libc_hard_shift.a -lc
+ ARG1= -v -Os -g -LC:\Impulse\CoDeveloper\/uClinux/lib/uClibc/lib 
+ mand_sw.o co_init.o co_stream.o co_signal.o co_register.o co_memory.o
co_process.o co_type.o
C:\Impulse\CoDeveloper\/uClinux/lib/uClibc/lib/crt0.o -lc
C:EDK/gnu/microblaze/nt/lib/gcc-lib/microblaze/2.95.3-4/libgcc.a
C:EDK/gnu/microblaze/nt/microblaze/lib/libc_hard_shift.a -lc
+ C:\Impulse\CoDeveloper\/uClinux/elf2flt/mktemp /tmp/flt-XXXXXX
+ NEWLDSCRIPT=/tmp/flt-a03428
+ SEDOP= -e s/^R_RODAT// -e /^W_RODAT/d
+ [  ]
+ [  ]
+ [ -z  ]
+ LDSCRIPT=C:\Impulse\CoDeveloper\/uClinux/elf2flt/../lib/elf2flt.ld
+ [ -f C:\Impulse\CoDeveloper\/uClinux/elf2flt/../lib/elf2flt.ld ]
+ sed -e s/^R_RODAT// -e /^W_RODAT/d
+ LDSCRIPT=/tmp/flt-a03428
+ [ yes = no ]
+ mb-ld -r -d -o mand.elf2flt -v -Os -g
-LC:\Impulse\CoDeveloper\/uClinux/lib/uClibc/lib mand_sw.o co_init.o
co_stream.o co_signal.o co_register.o co_memory.o co_process.o co_type.o
C:\Impulse\CoDeveloper\/uClinux/lib/uClibc/lib/crt0.o -lc
C:EDK/gnu/microblaze/nt/lib/gcc-lib/microblaze/2.95.3-4/libgcc.a
C:EDK/gnu/microblaze/nt/microblaze/lib/libc_hard_shift.a -lc
GNU ld version 2.10.1 Xilinx EDK 6.3 Build EDK_Gmm.10 (with BFD 2.10.1)
+ mb-ld -LC:\Impulse\CoDeveloper\/uClinux/lib/uClibc/lib -T 
+ /tmp/flt-a03428 -Ur -o mand.elf mand.elf2flt mb-ld 
+ -LC:\Impulse\CoDeveloper\/uClinux/lib/uClibc/lib -T /tmp/flt-a03428 -o

+ mand.gdb mand.elf2flt rm -f mand.elf2flt grep _GLOBAL_OFFSET_TABLE_ 
+ mand.gdb C:\Impulse\CoDeveloper\/uClinux/elf2flt/elf2flt -o mand -r 
+ mand.elf rm -f mand.elf rm -f /tmp/flt-a03428
+ exit 0


> -----Original Message-----
> From: owner-microblaze-uclinux@itee.uq.edu.au
> [mailto:owner-microblaze-uclinux@itee.uq.edu.au] On Behalf Of 
> Scott Thibault
> Sent: Wednesday, October 27, 2004 7:44 AM
> To: microblaze-uclinux@itee.uq.edu.au
> Subject: RE: [microblaze-uclinux] Building microblaze toolchain
> 
> 
> > > In my continued quest to build microblaze uClinux executables on 
> > > Windows, I'm trying to build the tool chain with MinGW.  I
> > tried using
> > > the EDK 6.3 cross-compiler, but I get a bad magic error
> > when trying to
> > > load them under uClinux.  I'm guessing here that there are some 
> > > version differences between the uClinux and the EDK toolchain.
> > 
> > Nothing so serious - to build uClinux executables you have to use a 
> > special little tool called elf2flt - it converts elf
> binaries into so
> > called "flat binaries" with relocation information.
> > 
> > Here's what to do - in your edk6.3 toolchain, rename mb-ld to 
> > mb-ld.real, and copy the mb-ld file from a linux toolchain.  It's 
> > actually a script, so it should run just fine under some
> sort of *n*x
> > emulation.
> > 
> > This script is a wrapper that runs elft2flt if necessary, and passes

> > files on to the real linker (mb-ld.real).
> 
> I initially tried using -W,l-elf2flt with the EDK, and it
> outputs a warning like: ld-elf2flt cannot find entry point: 
> assuming 00000000. So, it seemed like the EDK supported 
> -elf2flt.  Of course, as I said, uClinux couldn't load the 
> binary reporting a bad magic error.
> 
> > 
> > Then grab the elf2flt sources from cvs.uclinux.org - configure and 
> > build it, put it in your toolchain bin directory renamed as 
> > mb-elf2flt
> > 
> > The configuration is a little tricky, you have to point it
> at various
> > BFD and libiberty headers and libs that are produced when you
> > build the 
> > binutils.  ./configure --help will tell you the options you 
> > need to provide.
> 
> I did that.  That is why I was trying to build binutils, to
> get the libs it was looking for.
> 
> > > In any case, the Web site references a build_toolchain
> script file,
> > > but I can't find it anywhere.  Where do I get this file?
> > 
> > You'll need to specify target=microblaze...
> > 
> 
> But what do I put after microblaze?  Maybe
> microblaze-mingw32? According to the help it needs to match 
> that used to build binutils.  I suppose maybe I can try to 
> use the EDK libraries and search the binaries to see if they 
> contain the target name somewhere.
> 
> --Scott
> 
> ___________________________
> microblaze-uclinux mailing list
> microblaze-uclinux@itee.uq.edu.au Project Home Page : 
http://www.itee.uq.edu.au/~jwilliams/mblaze-uclinux
Mailing List Archive :
http://www.itee.uq.edu.au/~listarch/microblaze-uclinux/

___________________________
microblaze-uclinux mailing list
microblaze-uclinux@itee.uq.edu.au
Project Home Page : http://www.itee.uq.edu.au/~jwilliams/mblaze-uclinux
Mailing List Archive : http://www.itee.uq.edu.au/~listarch/microblaze-uclinux/