m68k-elf-tools -------------- Files: tools-20010228 - the source, doc and build scripts for the tools m68k-elf-tools-20010228.tar.gz - A tar (relative to /) of the tools. It includes gcc, g++, binutils, genromfs and elf2flt. It doesn't have the m68k-elf-gdb at this point. m68k-elf-g++-20010228.tar.gz - missing C++ header files until I can get them included properly. What do you get: * An m68k-elf compiler for all gcc support m68k architectures and scripts to help you build your own. * A new option for the m68k-elf-gcc, "-msep-data" that turns on "a5" relative data access, PIC code generation and removes the normal "a5" load/unload code on every function entry. Read through the intro to the patch in: tools-20010228/gcc-2.95.2-elfPICgot.patch for more information on the gcc changes. * A new elf2flt with support for the GOT table relocations in the above output. Command line support for ZFLAT binaries (-z) and a few other options like load to RAM (-r). * Changes to genromfs to allow device node creation without being root. A special empty file with the name "@filename,[cbp..],major,minor" will result in a device node in the generated romfs. * A script that replaces "ld" (ld is now called ld.real) that looks for a '-elf2flt' option, and produces a flat binary if this option is present. It will generate PIC/non-pic as required. It will automatically choose the elf2flt linker script unless you provide your own. To generate a flat file from gcc you will need to run: m68k-elf-gcc -Wl,-elf2flt -o c c.c Without the the "-elf2flt" option you will get normal elf binaries. If you want to do the conversions yourself, see the section later in this file on making flat files. This command will give you three files: c - the flat executable to put in the romfs c.gdb - run gdb on this file when debugging the application c.elf - the fully linked/relocatable elf file How to install: login as root cd / tar xvzf m68k-elf-tools-20010228.tar.gz tar xvzf m68k-elf-g++-20010228.tar.gz ensure "/usr/local/bin" is in your path. How to build your own: Read through the intro in "tools-20010228/build-m68k-elf.sh" Getting started on your own tree: First, you will need to get yourself the latest files from CVS. Both 2.0.x and 2.4.x have flat support for binaries from this toolchain. To patch an existing source base go for just: fs/binfmt_flat.c include/linux/flat.h Files from the older coff tools can still be loaded by this flat loader providing the are using version 2 flat files. The current CVS'd version of uClibc has the crt0.S changes required at startup. If you are already using PIC code then your startup shouldn't have to change much. You may find that your linker scripts needs a little work to support the new elf compiler. Mainly in alignments of sections etc. You will need to add the "-msep-data" option to your build to get working PIC code, you will also have to rebuild your libc and other libraries with this option. The tools tarball has versions of libgcc.a for msep-data/normal builds. You can use the tools build script to generate multilib versions of uClibc and install them in /usr/local if that is what you prefer. Making flat files by hand: If you do not want to use the linker replacement script, but build binaries by hand, then here are the basic steps: To generate a flat file that can do XIP: m68k-elf-gcc -msep-data -m68000 -c test.c m68k-elf-ld.real -d -r test.tmp crt0.o test.o libc.a \ /usr/local/lib/gcc-lib/m68k-elf/2.95.2/m68000/msep-data/libgcc.a m68k-elf-ld.real -T elf2flt.ld -Ur -o test.elf test.tmp m68k-elf-ld.real -T elf2flt.ld -o test.gdb test.tmp elf2flt -o test -p test.gdb test.elf For non-XIP fully relocated binaries change the elf2flt line to: elf2flt -r -o test test.elf You can force an XIP program to be loaded completely into RAM by adding the '-r' option to the elf2flt line. You can compress the flat binary by adding the '-z' option to the elf2flt line. '-z' implies that the binary is loaded into RAM and cannot do XIP.