Linux x86 to Solaris Sparc Cross Compiler
Kai Ruottu
karuottu@freenet.hut.fi
Sat Apr 1 00:00:00 GMT 2000
Alex Smith wrote:
> I am trying to create a cross compiler from a Rh6.1 to a Solaris Sparc 2.5.1
> machine.
>
> Here is my error message:
> /export/home/alesmi/compliers/solaris-sparc2.5.1/gcc/xgcc -B/export/home/alesmi/compliers/solaris-sparc2.5.1/gcc/ -B/usr/local/2.95.2/sparc-sun-solaris2.5.1/bin/ -I/usr/local/2.95.2/sparc-sun-solaris2.5.1/include -c -o crt1.o -x assembler-with-cpp ../../gcc-2.95.2/gcc/config/sparc/sol2-c1.asm
> _muldi3
> as: option `-s' is ambiguous
> make[1]: *** [crt1.o] Error 1
>
> Also, I found a thread from back in mid-febuary about troubles similar mine
> with a solaris x86 to solaris-sparc cross. Their problem was resolved by Kai
> who traced it to a bad DEFINE in gcc/config/i386/sol2gas.h.
>
> My problem is caused by gcc/config/sparc/sol2.h in the ASM_SPECS section.
The same kind of method can be used with this too. But you can also
simply edit the
resulted 'gcc/specs' and remove the bad '-s' from the '*asm:'-spec...
A 'clean' way could be to change the config entry in configure as
follows :
--------------------------- clip -------------------------------
sparc-*-solaris2*)
if test x$gnu_ld = xyes
then
tm_file=sparc/sol2.h
else
tm_file=sparc/sol2-sld.h
fi
+ if test x$gas = xyes;
+ then
+ # Only needed if gas does not support -s
+ tm_file="sparc/sol2gas.h ${tm_file}"
+ fi
xm_file="xm-siglist.h sparc/xm-sysv4.h sparc/xm-sol2.h"
xm_defines="USG POSIX"
tmake_file=sparc/t-sol2
xmake_file=sparc/x-sysv4
extra_parts="crt1.o crti.o crtn.o gcrt1.o gmon.o crtbegin.o crtend.o"
case $machine in
*-*-solaris2.[0-4])
float_format=i128
;;
*)
float_format=none
;;
esac
if test x${enable_threads} = x; then
enable_threads=$have_pthread_h
if test x${enable_threads} = x; then
enable_threads=$have_thread_h
fi
fi
if test x${enable_threads} = xyes; then
if test x${have_pthread_h} = xyes; then
thread_file='posix'
else
thread_file='solaris'
fi
fi
;;
--------------------------- clip -------------------------------
so 'sol2gas.h' will be included before 'sol.h' or 'sol2-sld.h', and add
the
following 'sol2gas.h' into 'gcc/config/sparc :
--------------------------- clip -------------------------------
/* Definitions of target machine for GNU compiler, for SPARC running
Solaris 2 with GNU as up to 2.9.5.0.12.
Copyright (C) 1999 Free Software Foundation, Inc.
*/
#ifndef GAS_REJECTS_MINUS_S
#define GAS_REJECTS_MINUS_S 1
#endif
/* Assume sol2.h will be included afterwards. */
--------------------------- clip -------------------------------
The 'gcc/config/sparc/sol2.h' should be patched too :
--------------------------- clip -------------------------------
*** sol2.bak Tue Dec 28 20:54:12 1999
--- sol2.h Sat Mar 18 11:12:10 2000
***************
*** 35,40 ****
--- 35,42 ----
%{compat-bsd:-iwithprefixbefore ucbinclude -I/usr/ucbinclude} \
"
+ #if ! GAS_REJECTS_MINUS_S
+
/* The sun bundled assembler doesn't accept -Yd, (and neither does
gas).
It's safe to pass -s always, even if -g is not used. */
#undef ASM_SPEC
***************
*** 43,48 ****
--- 45,60 ----
%{fpic:-K PIC} %{fPIC:-K PIC} \
%(asm_cpu) \
"
+ #else /* GAS_REJECTS_MINUS_S */
+
+ /* Same as above, except for -s, unsupported by GNU as. */
+ #undef ASM_SPEC
+ #define ASM_SPEC "\
+ %{v:-V} %{Qy:} %{!Qn:-Qy} %{n} %{T} %{Ym,*} %{Wa,*:%*} \
+ %{fpic:-K PIC} %{fPIC:-K PIC} \
+ %(asm_cpu) \
+ "
+ #endif /* GAS_REJECTS_MINUS_S */
/* This is here rather than in sparc.h because it's not known what
other assemblers will accept. */
--------------------------- clip -------------------------------
The 'sol2gas.h' was copied 'as is' from the egcs-20000306 snapshots
(from 'gcc/config/i386') and as the comment says, it was aimed to be
put into 'gcc/config/sparc', but then something seemingly happened
and the thing was forgotten. I don't remember who is the Solaris2
maintainer, but forwarding this to him/her, could be thought, the
snapshots didn't have the GNU as possibility handled yet either...
Perhaps the current gas snapshots already support the '-s', but with
with GNU as up to 2.9.5.0.12 this kind of handling seems to be needed.
Cheers, Kai
------
Want more information? See the CrossGCC FAQ, http://www.objsw.com/CrossGCC/
Want to unsubscribe? Send a note to crossgcc-unsubscribe@sourceware.cygnus.com
More information about the crossgcc
mailing list