[PATCH] Improved support for native as on solaris/x86

Roger Sayle roger@eyesopen.com
Thu Jul 20 17:37:00 GMT 2006


The following patch fixes a problem using the native SUN assembler on
solaris/x86.  It turns out that the command line options used to inform
the assembler whether to generate 32-bit vs. 64-bit binaries are
incompatible between GNU bintutil's gas and /usr/ccs/bin/as.  The
first uses --32 and --64 which are unrecognized by the latter, which
instead uses -xarch=generic and -xarch=generic64.  This is a regression
from gcc-3.4, which bootstraps by default using the native as, but this
now fails on mainline.  This patch allows a default bootstrap with
the native as to proceed further.

The patch uses the same usegas.h mechanism that is used on several
other platforms, that then defines USE_GAS which can be used by a
backend to customize its behaviour upon the assembler being used.

The following patch as been tested on i386-pc-solaris2.10 configured
with the options --enable-languages="c,c++,objc,fortran" and both with
and without "--with-gnu-as --with-as=/usr/local/bin/gas".  The former
bootstraps all select languages, and has no regressions from a top-level
"make -k check".  The second gets further than before.

Ok for mainline?  Is there a GWP or backend maintainer with an
interest in solaris/x86?



2006-07-20  Roger Sayle  <roger@eyesopen.com>

	* config.gcc (i[34567]86-*-solaris2*): Add usegas.h to $tm_file
	if the target assembler is GNU binutils' gas.
	* config/i386/sol2-10.h (ASM_SPEC): Check USE_GAS to determine
	whether to pass GNU gas or native as command line options.


Index: config.gcc
===================================================================
*** config.gcc	(revision 115568)
--- config.gcc	(working copy)
*************** i[34567]86-*-solaris2*)
*** 1164,1169 ****
--- 1164,1172 ----
  	else
  		tmake_file="$tmake_file t-slibgcc-sld"
  	fi
+ 	if test x$gas = xyes; then
+ 		tm_file="usegas.h ${tm_file}"
+ 	fi
  	case ${target} in
  	*-*-solaris2.[789] | *-*-solaris2.1[0-9]*)
  		tm_file="$tm_file tm-dwarf2.h"
Index: config/i386/sol2-10.h
===================================================================
*** config/i386/sol2-10.h	(revision 115568)
--- config/i386/sol2-10.h	(working copy)
*************** Boston, MA 02110-1301, USA.  */
*** 22,30 ****
--- 22,38 ----
  #undef ASM_COMMENT_START
  #define ASM_COMMENT_START "/"

+ /* binutils' GNU as understands --32 and --64, but the native Solaris
+    assembler requires -xarch=generic or -xarch=generic64 instead.  */
  #undef ASM_SPEC
+ #ifdef USE_GAS
  #define ASM_SPEC "%{v:-V} %{Qy:} %{!Qn:-Qy} %{n} %{T} %{Ym,*} %{Yd,*} " \
  		 "%{Wa,*:%*} %{m32:--32} %{m64:--64} -s %(asm_cpu)"
+ #else
+ #define ASM_SPEC "%{v:-V} %{Qy:} %{!Qn:-Qy} %{n} %{T} %{Ym,*} %{Yd,*} " \
+ 		 "%{Wa,*:%*} %{m32:-xarch=generic} %{m64:-xarch=generic64} " \
+ 		 "-s %(asm_cpu)"
+ #endif

  #undef NO_PROFILE_COUNTERS


Roger
--



More information about the Gcc-patches mailing list