[uClinux-dev] Hacking the compiler specs file

J R Lars listpoppa at home.se
Fri Nov 30 06:27:09 EST 2001


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?
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? :-)
3. Did I break anything when hacking the specs, making up for future
problems?

-Enjoy!
Lars
-------------- next part --------------
*asm:
%{m68851}%{mno-68851}%{m68881}%{mno-68881}%{msoft-float:-mno-68881 }%{m68000}%{m68302}%{mc68000}%{m68010}%{m68020}%{mc68020}%{m68030}%{m68040}%{m68020-40:-mc68040 }%{m68020-60:-mc68040 }%{m68060}%{mcpu32}%{m68332}%{m5200}%{m5307}%{mhwdiv}%{mno-hwdiv}%{mmac}%{mno-mac}%{!mc68000:%{!m68000:%{!m68302:%{!m68010:%{!mc68020:%{!m68020:%{!m68030:%{!m68040:%{!m68020-40:%{!m68020-60:%{!m68060:%{!mcpu32:%{!m68332:%{!m5200:%{!m5307:%(asm_cpu_default) }}}}}}}}}}}}}}} %{fPIC:--pcrel} %{fpic:--pcrel} %{msep-data:--pcrel} 

*asm_final:


*cpp:
%(cpp_fpu)%{!ansi:%{m68302:-Dmc68302 }%{m68010:-Dmc68010 }%{m68020:-Dmc68020 }%{mc68020:-Dmc68020 }%{m68030:-Dmc68030 }%{m68040:-Dmc68040 }%{m68020-40:-Dmc68020 -Dmc68030 -Dmc68040 }%{m68020-60:-Dmc68020 -Dmc68030 -Dmc68040 -Dmc68060 }%{m68060:-Dmc68060 }%{mcpu32:-Dmcpu32 } %{m68332:-Dmc68332 -Dmcpu32 }%{m5200:-Dmcf5200 }%{m5307:-Dmcf5307 -Dmcf5200 }} %{m68302:-D__mc68302__ -D__mc68302 }%{m68010:-D__mc68010__ -D__mc68010 }%{m68020:-D__mc68020__ -D__mc68020 }%{mc68020:-D__mc68020__ -D__mc68020 }%{m68030:-D__mc68030__ -D__mc68030 }%{m68040:-D__mc68040__ -D__mc68040 }%{m68020-40:-D__mc68020__ -D__mc68030__ -D__mc68040__ -D__mc68020 -D__mc68030 -D__mc68040 }%{m68020-60:-D__mc68020__ -D__mc68030__ -D__mc68040__ -D__mc68020 -D__mc68030 -D__mc68040 -D__mc68060__ -D__mc68060 }%{m68060:-D__mc68060__ -D__mc68060 }%{mcpu32:-D__mcpu32__ -D__mcpu32 }%{m68332:-D__mc68332__ -D__mc68332 -D__mcpu32__ -D__mcpu32 }%{m5200:-D__mcf5200__ -D__mcf5200 }%{m5307:-D__mcf5307__ -D__mcf5307 -D__mcf5200__ -D__mcf5200 } %{!mc68000:%{!m68000:%{!m68302:%{!m68010:%{!mc68020:%{!m68020:%{!m68030:%{!m68040:%{!m68020-40:%{!m68020-60:%{!m68060:%{!mcpu32: %{!m68332:%{!m5200:%{!m5307:%(cpp_cpu_default)}}}}}}}}}}}}}}} %{fPIC:-D__PIC__ -D__pic__} %{fpic:-D__PIC__ -D__pic__} %{msep-data:-D__PIC__ -D__pic__} %(cpp_subtarget) 

*cc1:
-m68000

*cc1plus:


*endfile:


*link:
-elf2flt

*lib:
%{!shared:%{g*:-lg} %{!p:%{!pg:-lc}}%{p:-lc_p}%{pg:-lc_p}}

*libgcc:
%{!shared:-lgcc}

*startfile:
%{!shared:%{pg:pgcrt0%O%s}%{!pg:%{p:pcrt0%O%s}%{!p:crt0%O%s}}}

*switches_need_spaces:


*signed_char:
%{funsigned-char:-D__CHAR_UNSIGNED__}

*predefines:
-Dmc68000 -D__embedded__ -Asystem(embedded) -Amachine(mc68000) -D__ELF__ -Dunix -Dlinux -Asystem(posix) -Dm68000 -Dm68k -D__linux__ -Asystem(uClinux) -Acpu(m68k) -Amachine(uClinux68k)

*cross_compile:
1

*version:
2.95.3

*multilib:
m68000 !m68000 !m68020 !m5200 !m5307 !mcpu32 !m68881 !msoft-float !msep-data;m68000 m68000 !m68020 !m5200 !m5307 !mcpu32 !m68881 !msoft-float !msep-data;m68020 !m68000 m68020 !m5200 !m5307 !mcpu32 !m68881 !msoft-float !msep-data;m5200 !m68000 !m68020 m5200 !m5307 !mcpu32 !m68881 !msoft-float !msep-data;m5307 !m68000 !m68020 !m5200 m5307 !mcpu32 !m68881 !msoft-float !msep-data;mcpu32 !m68000 !m68020 !m5200 !m5307 mcpu32 !m68881 !msoft-float !msep-data;m68881 !m68000 !m68020 !m5200 !m5307 !mcpu32 m68881 !msoft-float !msep-data;msoft-float !m68000 !m68020 !m5200 !m5307 !mcpu32 !m68881 msoft-float !msep-data;m68881/msep-data !m68000 !m68020 !m5200 !m5307 !mcpu32 m68881 !msoft-float msep-data;m68000/m68881 m68000 !m68020 !m5200 !m5307 !mcpu32 m68881 !msoft-float !msep-data;m68000/msep-data m68000 !m68020 !m5200 !m5307 !mcpu32 !m68881 !msoft-float msep-data;m68000/m68881/msep-data m68000 !m68020 !m5200 !m5307 !mcpu32 m68881 !msoft-float msep-data;m68020/m68881 !m68000 m68020 !m5200 !m5307 !mcpu32 m68881 !msoft-float !msep-data;m68020/msoft-float !m68000 m68020 !m5200 !m5307 !mcpu32 !m68881 msoft-float !msep-data;m68020/msep-data !m68000 m68020 !m5200 !m5307 !mcpu32 !m68881 !msoft-float msep-data;m68020/m68881/msep-data !m68000 m68020 !m5200 !m5307 !mcpu32 m68881 !msoft-float msep-data;m68020/msoft-float/msep-data !m68000 m68020 !m5200 !m5307 !mcpu32 !m68881 msoft-float msep-data;m5200/msep-data !m68000 !m68020 m5200 !m5307 !mcpu32 !m68881 !msoft-float msep-data;m5307/msep-data !m68000 !m68020 !m5200 m5307 !mcpu32 !m68881 !msoft-float msep-data;mcpu32/msep-data !m68000 !m68020 !m5200 !m5307 mcpu32 !m68881 !msoft-float msep-data;

*multilib_defaults:
m68000

*multilib_extra:


*multilib_matches:
mc68000 m68000;m68302 m68000;m68332 mcpu32;mc68020 m68020;m68040 m68020;m68060 m68020;m68000 m68000;m68020 m68020;m5200 m5200;m5307 m5307;mcpu32 mcpu32;m68881 m68881;msoft-float msoft-float;msep-data msep-data;

*linker:
collect2

*cpp_cpu_default:


*cpp_fpu:


*cpp_subtarget:


*asm_cpu_default:
-m68000

*link_command:
%{!fsyntax-only:  %{!c:%{!M:%{!MM:%{!E:%{!S:%(linker) %l %X %{o*} %{A} %{d} %{e*} %{m} %{N} %{n} 			%{r} %{s} %{t} %{u*} %{x} %{z} %{Z}			%{!A:%{!nostdlib:%{!nostartfiles:%S}}}			%{static:} %{L*} %D %o			%{!nostdlib:%{!nodefaultlibs:%G %L %G}}			%{!A:%{!nostdlib:%{!nostartfiles:%E}}}			%{T*}			
 }}}}}}


More information about the uClinux-dev mailing list