Hello,
I'm trying to write a specs file to help with some issues and I cannot
get "multilib" features to work correctly.
I am cross compiling to various "system on a chip" type platforms, and
effectively, I would like to specify something like:
arm-elf-gcc --specs=<CHIPNAME>.spec
I have several chips I need to support. ARM-ELF, is but one example.
The part that does not work is options such as: '-mthumb' (vrs the
default 'marm'). For some reason, they only work if and only if the
-m<option> is specified on the actual compiler invocation line.
Below is an example .SPEC file "at91sam7x256.specs" file (below) works
*IN*CORRECTLY* I do not know why
The "-mthumb" option (I put in "multilib_defaults) should specify the
compiler link ".o" files from for
example the "thumb" subdirectory. Reason: I set the "defaults" to
mthumb, and mcpu=arm7tdmi and mthumb-interwork
It does not, it links them from the 'default' or "." library directory,
see below for more detail.
---cut-here---
*multilib_defaults:
mthumb mcpu=arm7tdmi mlittle-endian msoft-float mthumb-interwork
fno-leading-underscore
*startfile:
crti%O%s crtbegin%O%s at91sam7x256_crt0%O%s
*lib:
-larm -latmel -lat91sam7x256 %{!shared:%{g*:-lg}
%{!p:%{!pg:-lc}}%{p:-lc_p}%{pg:-lc_p}}
*link:
-T at91sam7x256_flash.ld
---cut-here---
The resulting "arm-elf-gcc -v" output is here:
--cut-here--
../Install/bin/arm-elf-gcc --specs='./aa.specs' -v ./hello_world.c
Using built-in specs.
Reading specs from ./aa.specs
Target: arm-elf
Configured with: ./configure --prefix=/home/duane/jtag/Install
--target=arm-elf --enable-languages=c
Thread model: single
gcc version 4.2.2
/home/duane/jtag/Install/libexec/gcc/arm-elf/4.2.2/cc1 -quiet -v
-D__USES_INITFINI__ ./hello_world.c -quiet -dumpbase hello_world.c
-auxbase hello_world -version -o /tmp/ccH3j6GH.s
ignoring nonexistent directory
"/home/duane/jtag/Install/lib/gcc/arm-elf/4.2.2/../../../../arm-elf/sys-include"
#include "..." search starts here:
#include <...> search starts here:
/home/duane/jtag/Install/lib/gcc/arm-elf/4.2.2/include
/home/duane/jtag/Install/lib/gcc/arm-elf/4.2.2/../../../../arm-elf/include
End of search list.
GNU C version 4.2.2 (arm-elf)
compiled by GNU C version 4.1.3 20070929 (prerelease) (Ubuntu
4.1.2-16ubuntu2).
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
Compiler executable checksum: 3cf95dd0f7b6c3efb0a6c02137312ac7
/home/duane/jtag/Install/lib/gcc/arm-elf/4.2.2/../../../../arm-elf/bin/as
-o /tmp/cc2M3hEh.o /tmp/ccH3j6GH.s
/home/duane/jtag/Install/libexec/gcc/arm-elf/4.2.2/collect2 -T
at91sam7x256_flash.ld
/home/duane/jtag/Install/lib/gcc/arm-elf/4.2.2/crti.o
/home/duane/jtag/Install/lib/gcc/arm-elf/4.2.2/crtbegin.o
at91sam7x256_crt0.o -L/home/duane/jtag/Install/lib/gcc/arm-elf/4.2.2
-L/home/duane/jtag/Install/lib/gcc/arm-elf/4.2.2/../../../../arm-elf/lib
/tmp/cc2M3hEh.o --start-group -lgcc -larm -latmel -lat91sam7x256 -lc
--end-group /home/duane/jtag/Install/lib/gcc/arm-elf/4.2.2/crtend.o
/home/duane/jtag/Install/lib/gcc/arm-elf/4.2.2/crtn.o
/home/duane/jtag/Install/lib/gcc/arm-elf/4.2.2/../../../../arm-elf/bin/ld:
cannot open linker script file at91sam7x256_flash.ld: No such file or
directory
collect2: ld returned 1 exit status
---cut-here--
NOTE: in the above, the linker correctly issues an error about
"at91sam7x256_flash.ld" - that *IS*NOT* my complaint.
Look more closely and you will see for example:
WRONG:
/home/duane/jtag/Install/lib/gcc/arm-elf/4.2.2/crtbegin.o
This should be, (because "-mthumb" and -mthumb-interwork is enabled)
/home/duane/jtag/Install/lib/gcc/arm-elf/4.2.2/thumb/thumb-interwork/crtbegin.o
That "/thumb/" and others seem to only work on the *COMMAND*LINE* - and
is not setable via the SPECs file.
In my searching, I did find somebody else described this problem 2 years
ago -but there are no valid responses.
Here: http://gcc.gnu.org/ml/gcc/2005-03/msg00523.html
Which - the same general idea I want to do.
Any suggestions would be very helpful.
-Duane.