Building gcc for solaris on sparc64 from linux on x86

David Cournapeau david@ar.media.kyoto-u.ac.jp
Thu Nov 2 02:09:00 GMT 2006


Kai Ruottu wrote:
> David Cournapeau wrote:
>>    Then, I used this toolchain to build on M1 a "native" solaris gcc: 
>> I used a scheme analog to the cross compiler, except that I set host 
>> and target to sparc-sun-solaris2.9, and build to i686-pc-gnu. The 
>> compilation went Ok too, but I cannot make this new compiler work on 
>> M2. I installed all the programs with the prefix $HOME/solaris/local/ 
>> on M2, and added $HOME/solaris/local/bin in my PATH.
> Generally a crosscompiler produces "identical" stuff with the native 
> compiler... BESIDES when runs that
> '*gcc -dumpspecs' to produce the 'specs' !   This is one of the 
> mistakes people usually do, they trust the
> cross-compiler produced 'specs' to work on the native system too!
>
> So I would check this "stupid mistake" :-) first  !
>
(sorry for the double posting, I mistakely send the email to Kai only first)

I understand that compiling with a cross compiler to M2 and a native 
compiler on M2 will produce the same programs more or less; 
unfortunately, I want to compile python for M2, which configuration 
needs to run on M2. That's the justification for building a native 
compiler for M2.

Now, I am not sure to understand the dumpspecs stuff, and how it 
matters. Where (eg which step) is it used, and for what purpose ?

Here is the specs for the "native" gcc I built (with host and target for 
solaris):

*asm:
--traditional-format %{v:-V} %{Qy:} %{!Qn:-Qy} %{n} %{T} %{Ym,*} 
%{Wa,*:%*} -s %{fpic|fpie|fPIC|fPIE:-K PIC} %(asm_cpu)

*asm_debug:
%{gstabs*:--gstabs}%{!gstabs*:%{g*:--gdwarf2}}

*asm_final:


*asm_options:
%a %Y %{c:%W{o*}%{!o*:-o %w%b%O}}%{!c:-o %d%w%u%O}

*invoke_as:
%{!S:-o %|.s |
as %(asm_options) %|.s %A }

*cpp:
%(cpp_cpu) %(cpp_arch) %(cpp_endian) %(cpp_subtarget)

*cpp_options:
%(cpp_unique_options) %1 %{m*} %{std*&ansi&trigraphs} %{W*&pedantic*} 
%{w} %{f*} %{g*:%{!g0:%{!fno-working-directory:-fworking-directory}}} 
%{O*} %{undef} %{save-temps:-fpch-preprocess}

*cpp_debug_options:
%{d*}

*cpp_unique_options:
%{C|CC:%{!E:%eGCC does not support -C or -CC without -E}} %{!Q:-quiet} 
%{nostdinc*} %{C} %{CC} %{v} %{I*&F*} %{P} %I %{MD:-MD 
%{!o:%b.d}%{o*:%.d%*}} %{MMD:-MMD %{!o:%b.d}%{o*:%.d%*}} %{M} %{MM} 
%{MF*} %{MG} %{MP} %{MQ*} %{MT*} %{!E:%{!M:%{!MM:%{MD|MMD:%{o*:-MQ 
%*}}}}} %{remap} %{g3:-dD} %{H} %C %{D*&U*&A*} %{i*} %Z %i 
%{fmudflap:-D_MUDFLAP -include mf-runtime.h} %{fmudflapth:-D_MUDFLAP 
-D_MUDFLAPTH -include mf-runtime.h} %{E|M|MM:%W{o*}}

*trad_capable_cpp:
cc1 -E %{traditional|ftraditional|traditional-cpp:-traditional-cpp}

*cc1:
%{sun4:} %{target:} %{mcypress:-mcpu=cypress} 
%{msparclite:-mcpu=sparclite} %{mf930:-mcpu=f930} %{mf934:-mcpu=f934} 
%{mv8:-mcpu=v8} %{msupersparc:-mcpu=supersparc} %{m32:%{m64:%emay not 
use both -m32 and -m64}} %{m64:-mptr64 -mstack-bias -mno-v8plus   
%{!mcpu*:%{!mcypress:%{!msparclite:%{!mf930:%{!mf934:%{!mv8*:%{!msupersparc:-mcpu=v9}}}}}}}} 


*cc1_options:
%{pg:%{fomit-frame-pointer:%e-pg and -fomit-frame-pointer are 
incompatible}} %1 %{!Q:-quiet} -dumpbase %B %{d*} %{m*} %{a*} 
%{c|S:%{o*:-auxbase-strip %*}%{!o*:-auxbase %b}}%{!c:%{!S:-auxbase %b}} 
%{g*} %{O*} %{W*&pedantic*} %{w} %{std*&ansi&trigraphs} %{v:-version} 
%{pg:-p} %{p} %{f*} %{undef} %{Qn:-fno-ident} %{--help:--help} 
%{--target-help:--target-help} %{!fsyntax-only:%{S:%W{o*}%{!o*:-o 
%b.s}}} %{fsyntax-only:-o %j} %{-param*} 
%{fmudflap|fmudflapth:-fno-builtin -fno-merge-constants}

*cc1plus:


*link_gcc_c_sequence:
%G %L %G %L

*endfile:
%{ffast-math|funsafe-math-optimizations:crtfastmath.o%s}    crtend.o%s 
crtn.o%s

*link:
%{h*} %{v:-V}    %{b} %{Wl,*:%*}    %{static:-dn -Bstatic}    
%{shared:-G -dy %{!mimpure-text:-z text}}    %{symbolic:-Bsymbolic -G 
-dy -z text}    %(link_arch)    %{Qy:} %{!Qn:-Qy}

*lib:
%{compat-bsd:-lucb -lsocket -lnsl -lelf -laio}    %{!shared:     
%{!symbolic:       %{pthreads:-lpthread}        
%{!pthreads:%{threads:-lthread}}        %{p|pg:-ldl} -lc}}

*mfwrap:
%{static: %{fmudflap|fmudflapth:  --wrap=malloc --wrap=free 
--wrap=calloc --wrap=realloc --wrap=mmap --wrap=munmap --wrap=alloca} 
%{fmudflapth: --wrap=pthread_create --wrap=pthread_join 
--wrap=pthread_exit}} %{fmudflap|fmudflapth: --wrap=main}

*mflib:
%{fmudflap|fmudflapth: -export-dynamic}

*libgcc:
%{static|static-libgcc:-lgcc 
-lgcc_eh}%{!static:%{!static-libgcc:%{!shared:%{!shared-libgcc:-lgcc 
-lgcc_eh}%{shared-libgcc:-lgcc_s -lgcc}}%{shared:-lgcc_s}}}

*startfile:
%{!shared:              %{!symbolic:               
%{p:mcrt1.o%s}                           %{!p:                         
%{pg:gcrt1.o%s gmon.o%s}                             %{!pg:crt1.o%s}}}} 
           crti.o%s %(startfile_arch)             crtbegin.o%s

*switches_need_spaces:


*cross_compile:
0

*version:
4.0.3

*multilib:
. !m32 !m64;sparcv7:. m32 !m64;sparcv9:sparcv9 !m32 m64;

*multilib_defaults:
m32

So if 0 is really false, it looks like the specs say it is not a cross 
compiler, right ?

cheers,

David

--
For unsubscribe information see http://sourceware.org/lists.html#faq



More information about the crossgcc mailing list