[uClinux-dev] Hacking the compiler specs file

David McCullough davidm at snapgear.com
Fri Nov 30 07:37:02 EST 2001


Jivin J R Lars lays it down ...
> I'm trying to port some applications to uClinux using m68k-elf-gcc. Most
> autoconf scripts (and many plain Makefiles) fails since the compiler
> behaves differently than expected. Though I really don't *understand*
> the compiler specs file, I compared it with a standard RedHat gcc and
> the m68k-pic-coff-gcc, and tweaked it so that it works much better for
> me. As an example, on most systems I know of, you can compile the famous
> hello.c with just "gcc -o hello hello.c". With my new specs file, this
> is the case (it incorporates the "-m68000 -Wl,-elf2flt -lc"). Now most
> autoconf scripts runs OK, giving me a good starting point, with the
> following input:
> CC=m68k-elf-gcc ./configure (...)
> 
> I attach the file in case it helps anyone. It is meant to replace
> /opt/uClinux/lib/gcc-lib/m68k-elf/2.95.3/specs though I recommend saving
> the original. I use the original for compiling the kernel and other
> stuff that has the right magic in it's Makefiles already.
> 
> But this whole issue puzzles me, so a few questions remains:
> 1. Why wasn't the compiler configured this way in the first place? Are
> there any drawbacks?

The compiler can be used for multiple targets,  -m68000 is just one of
them.  The changes you have made make it specific to the 68000 platform.

I use the compiler for coldfir and 68000 platforms and appreciate only
needing one compiler for all the code I compile,  including PIC or non-PIC,
kernel and user, boot loaders and startup code.

> 2. Did I completely misunderstand the whole problem? Are you all having
> a bunch of magic environment variables set that obsoletes my work? Are
> you now laughing at me? :-)

Nah,  if it works for you then that's all that matters.

You could probably get by with just adding '-lc' to the library part of the
spec file are running something like:

	CC="m68k-elf-gcc -m68000 -Wl,-elf2flt"

but at the end of the day it's whatever works best for you.

> 3. Did I break anything when hacking the specs, making up for future
> problems?


By ading -elf2flt to the linker lines you have probably broken kernel
builds.  You shouldn't need this as you can get away with including that
like above.


If it's all working then it probably isn't broken ;-) ;-)

Cheers,
Davidm

-- 
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