Patchwork Simplify Solaris configuration

login
register
mail settings
Submitter Rainer Orth
Date June 20, 2011, 5:19 p.m.
Message ID <yddvcw0l8sk.fsf@manam.CeBiTec.Uni-Bielefeld.DE>
Download mbox | patch
Permalink /patch/101168/
State New
Headers show

Comments

Rainer Orth - June 20, 2011, 5:19 p.m.
I had long meant to do another round of cleanups of the Solaris
configuration, which has much duplication and inconsistencies between
the SPARC and x86 versions.

The following patch is the result of this work.  It consists of several
parts:

* Move the common Solaris parts in config.gcc to the *-*-solaris2* case.

* Since the Solaris/SPARC port is pure bi-arch by now, there's no point
  to have separate sparc/sol2.h and sparc/sol2-bi.h (and similar gas and
  gld) headers where the latter sometimes just override definitions in
  the former.

* We already use USE_GAS to conditionally define GNU as or Sun
  as-specific stuff.  I'm introducing usegld.h and USE_GLD for the same
  purpose, replacing the Solaris/x86-only TARGET_GNU_LD.  I'm merging
  all the sol2-gas*.h and sol2-gld*.h headers into the base headers
  since it is far easier to see what's going on if the variants are
  close.

* I do introduce a new config/sol2-bi.h since while the SPARC port is
  bi-arch only, the x86 port only is since Solaris 10.  Many of the
  previous SPARC-only definitions are really generic or can easily be
  made so, so this removes duplication between the two and paves the way
  for an eventual 64-bit-default Solaris/x86 configuration.

* The ordering of definitions in the headers often seemed pretty
  random.  I've reordered them to appear a little more logical.
  Unfortunately, this makes the patch harder to read; it's easier to see
  what's going on in the patched files.

* I've completely removed the -compat-bsd support.  /usr/ucblib is gone
  in Solaris 11, and has only been a migration aid in the early Solaris
  2.0 days, with all coding guidelines warning against its use.

* config/sol2.h defined PREFERRED_DEBUGGING_TYPE DBX_DEBUG, only to have
  it overridden by tm-dwarf2.h in config.gcc.  This is completely
  pointless, so I'm removing both the sol2.h definition and the
  tm-dwarf2.h include since DWARF2_DEBUG is the elfos.h default already.

* I'm removing -rpath-link /usr/lib resp. /usr/lib/sparcv9 from
  LINK_ARCH{32,64}_SPEC.  All other ports have already removed it, it's
  the default and the Solaris/x86 port has worked fine without.

There are a couple of open questions and FIXMEs right now:

* In config/sol2-bi.h, LINK_ARCH64_SPEC contains

  "%{mcmodel=medlow:-M /usr/lib/ld/" ARCH64_SUBDIR "/map.below4G} "

  Except for the name of the code models, there's nothing SPARC-specific
  here.  I think at least -mcmodel=small on x86 needs the same linker
  map, maybe even -mcmodel=medium.

* CPP_SUBTARGET_SPEC still has -D_PTHREADS.  This is unused in the tree;
  only libstdc++-v3/acinclude.m4 defines it for all targets.  I suppose
  this can go?

* One might want to simplify the different ASM_SPECs.  I may do this
  before checkin or as a followup.

Bootstrapped without regressions on i386-pc-solaris2.11 (Sun as/ld, GNU
as/Sun ld, GNU as, ld), i386-pc-solaris2.10 (Sun as/ld), and
sparc-sun-solaris2.11 (Sun as/ld) so far.  Bootstraps on
i386-pc-solaris2.[89], sparc-sun-solaris2.8, sparc-sun-solaris2.10 and
the remaining tool combinations are still running.

Will commit unless Eric sees problems or the bootstraps reveal
regressions.

	Rainer


2011-06-19  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>

	gcc:
	* config/usegld.h: New file.
	* config/sol2.h (PREFERRED_DEBUGGING_TYPE): Remove.
	(CPP_SUBTARGET_SPEC): Remove -compat-bsd support.
	(LIB_SPEC): Likewise.
	Search /lib.
	(LINK_ARCH32_SPEC_BASE): Remove -compat-bsd support.
	(RDYNAMIC_SPEC): Handle GNU ld.
	[HAVE_LD_EH_FRAME_HDR && TARGET_DL_ITERATE_PHDR] (LINK_EH_SPEC): Define.
	(SUPPORTS_INIT_PRIORITY): Only disable for Sun ld.
	(SUBTARGET_INSERT_ATTRIBUTES, SUBTARGET_ATTRIBUTE_TABLE): Define.
	[!USE_GAS] (NO_DBX_BNSYM_ENSYM): Redefine.
	(STACK_CHECK_STATIC_BUILTIN): Define.

	* config/sol2.opt (compat-bsd): Remove.
	* config/sol2-10.h (TARGET_C99_FUNCTIONS): Remove undef.
	* config/sol2-bi.h: New file.
	* config/sol2-gld.h: Remove.
	* config/i386/sol2.h (TLS_COMMON_ASM_OP): Only define if !USE_GAS.
	(NO_DBX_BNSYM_ENSYM): Remove.
	(SUBTARGET_INSERT_ATTRIBUTES, SUBTARGET_ATTRIBUTE_TABLE): Remove.
	(STACK_CHECK_STATIC_BUILTIN): Remove.
	Test USE_GLD instead of TARGET_GNU_LD.
	* config/i386/sol2-10.h: Rename to ...
	* config/i386/sol2-bi.h .. this.
	(SUBTARGET_EXTRA_SPECS): Redefine.
	(WCHAR_TYPE, WCHAR_TYPE_SIZE, WINT_TYPE, WINT_TYPE_SIZE): Remove.
	(MULTILIB_DEFAULTS): Remove.
	(DEFAULT_ARCH32_P): Define.
	(LINK_ARCH64_SPEC_BASE, LINK_ARCH64_SPEC): Remove.
	(ARCH64_SUBDIR): Define.
	Test USE_GLD instead of TARGET_GNU_LD.
	(I386_EMULATION): Rename to ...
	(ARCH32_EMULATION): ... this.
	(X86_64_EMULATION): Rename to ...
	(ARCH64_EMULATION): ... this.
	(TARGET_LD_EMULATION): Remove.
	(LINK_ARCH_SPEC): Remove.
	* config/i386/sol2-gas.h: Remove.
	* config/i386/t-sol2-10: Rename to ...
	* config/i386/t-sol2-64: ... this.
	* config/sparc/sol2.h (SPARC_DEFAULT_CMODEL): Redefine.
	(AS_SPARC64_FLAG): Define.
	(ASM_CPU32_DEFAULT_SPEC, ASM_CPU64_DEFAULT_SPEC): Redefine.
	(CPP_CPU64_DEFAULT_SPEC, ASM_CPU32_DEFAULT_SPEC): Redefine
	depending on TARGET_CPU_DEFAULT.
	(CPP_CPU_SPEC): Redefine.
	(ASM_CPU_SPEC): Handle DEFAULT_ARCH32_P.
	(CPP_CPU_DEFAULT_SPEC, ASM_CPU_DEFAULT_SPEC): Redefine.
	(CPP_ARCH32_SPEC, CPP_ARCH64_SPEC, CPP_ARCH_SPEC): Redefine.
	(ASM_ARCH_SPEC, ASM_ARCH32_SPEC, ASM_ARCH64_SPEC,
	ASM_ARCH_DEFAULT_SPEC): Redefine.
	(SUBTARGET_EXTRA_SPECS): Add LINK_ARCH32_SPEC, LINK_ARCH64_SPEC,
	LINK_ARCH_DEFAULT_SPEC.
	[USE_GLD] (ARCH32_EMULATION, ARCH64_EMULATION): Define.
	[USE_GLD] (LINK_ARCH32_SPEC, LINK_ARCH64_SPEC): Redefine.
	(ARCH64_SUBDIR): Define.
	(LINK_ARCH64_SPEC): Redefine.
	(CC1_SPEC): Redefine.
	(OPTION_DEFAULT_SPECS): Redefine.
	(MULTILIB_DEFAULTS): Define.
	(WCHAR_TYPE, WCHAR_TYPE_SIZE, WINT_TYPE, WINT_TYPE_SIZE): Redefine.
	[USE_GAS && HAVE_AS_TLS] (TARGET_SUN_TLS, TARGET_GNU_TLS): Redefine.
	[USE_GLD] (CTORS_SECTION_ASM_OP, DTORS_SECTION_ASM_OP): Undef.
	(NO_DBX_BNSYM_ENSYM): Remove.
	(SUBTARGET_INSERT_ATTRIBUTES, SUBTARGET_ATTRIBUTE_TABLE): Remove.
	(ASM_OUTPUT_ALIGN_WITH_NOP): Only define if !USE_GAS.
	(TARGET_ASM_NAMED_SECTION): Likewise.
	(STACK_CHECK_STATIC_BUILTIN): Remove.
	* config/sparc/sol2-bi.h: Remove.
	* config/sparc/sol2-gas-bi.h: Remove.
	* config/sparc/sol2-gas.h: Remove.
	* config/sparc/sol2-gld-bi.h: Remove.
	* config.gcc (i[34567]86-*-solaris2*, sparc*-*-solaris2*): Move
	common parts ...
	(*-*-solaris2*): ... here.
Rainer Orth - June 21, 2011, 8:56 a.m.
Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE> writes:

> Bootstrapped without regressions on i386-pc-solaris2.11 (Sun as/ld, GNU
> as/Sun ld, GNU as, ld), i386-pc-solaris2.10 (Sun as/ld), and
> sparc-sun-solaris2.11 (Sun as/ld) so far.  Bootstraps on
> i386-pc-solaris2.[89], sparc-sun-solaris2.8, sparc-sun-solaris2.10 and
> the remaining tool combinations are still running.
>
> Will commit unless Eric sees problems or the bootstraps reveal
> regressions.

All bootstraps completed without regressions, so I've installed the
patch.  I'll address eventual issues and further simplifications as a
followup.

	Rainer
Eric Botcazou - June 21, 2011, 9:43 a.m.
> Bootstrapped without regressions on i386-pc-solaris2.11 (Sun as/ld, GNU
> as/Sun ld, GNU as, ld), i386-pc-solaris2.10 (Sun as/ld), and
> sparc-sun-solaris2.11 (Sun as/ld) so far.  Bootstraps on
> i386-pc-solaris2.[89], sparc-sun-solaris2.8, sparc-sun-solaris2.10 and
> the remaining tool combinations are still running.
>
> Will commit unless Eric sees problems or the bootstraps reveal
> regressions.

None, but this might be a side effect of the number of hours you have in order 
to look at the patch before it gets installed. :-)
Eric Botcazou - June 25, 2011, 11:09 a.m.
> All bootstraps completed without regressions, so I've installed the
> patch.  I'll address eventual issues and further simplifications as a
> followup.

I cannot bootstrap SPARC64/Solaris anymore though:

/nile.build/botcazou/gcc-head/sparc64-sun-solaris2.9/./gcc/xgcc -B/nile.build/botcazou/gcc-head/sparc64-sun-solaris2.9/./gcc/ -B/nile.build/botcazou/gcc-head/install_sparc64/sparc64-sun-solaris2.9/bin/ -B/nile.build/botcazou/gcc-head/install_sparc64/sparc64-sun-solaris2.9/lib/ -isystem /nile.build/botcazou/gcc-head/install_sparc64/sparc64-sun-solaris2.9/include -isystem /nile.build/botcazou/gcc-head/install_sparc64/sparc64-sun-solaris2.9/sys-include    -g -O2 -O2  -g -O2 -DIN_GCC   -W -Wall -Wwrite-strings -Wcast-qual -Wstrict-prototypes -Wmissing-prototypes -Wold-style-definition  -isystem ./include  -fPIC -g -DHAVE_GTHR_DEFAULT -DIN_LIBGCC2 -D__GCC_FLOAT_NOT_NEEDED -fbuilding-libgcc -fno-stack-protector  -fPIC -I. -I. -I../.././gcc -I/nile.build/botcazou/gcc-head/src/libgcc -I/nile.build/botcazou/gcc-head/src/libgcc/. -I/nile.build/botcazou/gcc-head/src/libgcc/../gcc -I/nile.build/botcazou/gcc-head/src/libgcc/../include  -DHAVE_CC_TLS  -o 
_muldi3.o -MT _muldi3.o -MD -MP -MF 
_muldi3.dep -DL_muldi3 -c /nile.build/botcazou/gcc-head/src/libgcc/../gcc/libgcc2.c 
\
  -fvisibility=hidden -DHIDE_EXPORTS
In file included 
from /nile.build/botcazou/gcc-head/sparc64-sun-solaris2.9/./gcc/include-fixed/sys/feature_tests.h:24:0,
                 
from /nile.build/botcazou/gcc-head/sparc64-sun-solaris2.9/./gcc/include-fixed/iso/stdio_iso.h:44,
                 
from /nile.build/botcazou/gcc-head/sparc64-sun-solaris2.9/./gcc/include-fixed/stdio.h:36,
                 
from /nile.build/botcazou/gcc-head/src/libgcc/../gcc/tsystem.h:87,
                 
from /nile.build/botcazou/gcc-head/src/libgcc/../gcc/libgcc2.c:29:
/usr/include/sys/isa_defs.h:280:2: error: #error "SPARC Versions 8 and 9 are 
mutually exclusive choices"
/usr/include/sys/isa_defs.h:376:2: error: #error "Both _ILP32 and _LP64 are 
defined"
make[3]: *** [_muldi3.o] Error 1
make[3]: Leaving directory 
`/nfs/nile/nile.build/botcazou/gcc-head/sparc64-sun-solaris2.9/sparc64-sun-solaris2.9/libgcc'
make[2]: *** [all-stage1-target-libgcc] Error 2
make[2]: Leaving directory 
`/nfs/nile/nile.build/botcazou/gcc-head/sparc64-sun-solaris2.9'
make[1]: *** [stage1-bubble] Error 2
make[1]: Leaving directory 
`/nfs/nile/nile.build/botcazou/gcc-head/sparc64-sun-solaris2.9'
make: *** [all] Error 2

Patch

diff --git a/gcc/config.gcc b/gcc/config.gcc
--- a/gcc/config.gcc
+++ b/gcc/config.gcc
@@ -686,7 +686,35 @@  case ${target} in
   tm_defines="$tm_defines DEFAULT_LIBC=LIBC_UCLIBC SINGLE_LIBC"
   ;;
 *-*-solaris2*)
+  # i?86-*-solaris2* needs to insert headers between cpu default and
+  # Solaris 2 specific ones.
+  sol2_tm_file="dbxelf.h elfos.h ${cpu_type}/sysv4.h sol2.h ${cpu_type}/sol2.h"
+  case ${target} in
+    *-*-solaris2.1[0-9]*)
+      sol2_tm_file="${sol2_tm_file} sol2-10.h"
+      use_gcc_stdint=wrap
+      ;;
+    *)
+      use_gcc_stdint=provide
+      ;;
+  esac
+  if test x$gnu_ld = xyes; then
+    tm_file="usegld.h ${tm_file}"
+  fi
+  if test x$gas = xyes; then
+    tm_file="usegas.h ${tm_file}"
+  fi
+  tm_p_file="${tm_p_file} sol2-protos.h"
+  tmake_file="${tmake_file} t-sol2 t-slibgcc-dummy"
+  c_target_objs="${c_target_objs} sol2-c.o"
+  cxx_target_objs="${cxx_target_objs} sol2-c.o"
+  extra_objs="sol2.o"
   extra_options="${extra_options} sol2.opt"
+  case ${enable_threads}:${have_pthread_h}:${have_thread_h} in
+    "":yes:* | yes:yes:* )
+      thread_file=posix
+      ;;
+  esac
   ;;
 *-*-*vms*)
   extra_options="${extra_options} vms/vms.opt"
@@ -1335,7 +1363,7 @@  i[34567]86-*-rtems*)
 	tmake_file="${tmake_file} i386/t-rtems t-rtems"
 	;;
 i[34567]86-*-solaris2*)
-	tm_file="${tm_file} i386/unix.h i386/att.h dbxelf.h elfos.h i386/sysv4.h sol2.h"
+	tm_file="${tm_file} i386/unix.h i386/att.h ${sol2_tm_file}"
 	# Set default arch_32 to pentium4, tune_32 to generic like the other
 	# i386 targets, although config.guess defaults to i386-pc-solaris2*.
 	case ${target} in
@@ -1351,36 +1379,11 @@  i[34567]86-*-solaris2*)
 	with_tune_32=${with_tune_32:-generic}
 	case ${target} in
 	*-*-solaris2.1[0-9]*)
-		tm_file="${tm_file} sol2-10.h"
-		;;
-	esac
-	tm_file="${tm_file} i386/sol2.h"
-	if test x$gnu_ld = xyes; then
-		tm_file="${tm_file} sol2-gld.h"
-	fi
-	if test x$gas = xyes; then
-		tm_file="${tm_file} i386/sol2-gas.h"
-	fi
-	tmake_file="${tmake_file} t-sol2 t-slibgcc-dummy"
-	c_target_objs="${c_target_objs} sol2-c.o"
-	cxx_target_objs="${cxx_target_objs} sol2-c.o"
-	extra_objs="sol2.o"
-	tm_p_file="${tm_p_file} sol2-protos.h"
-	if test x$gnu_ld = xyes; then
-		tm_defines="${tm_defines} TARGET_GNU_LD=1"
-	fi
-	if test x$gas = xyes; then
-		tm_file="usegas.h ${tm_file}"
-	fi
-	tm_file="$tm_file tm-dwarf2.h"
-	case ${target} in
-	*-*-solaris2.1[0-9]*)
-		tm_file="${tm_file} i386/x86-64.h i386/sol2-10.h"
+		tm_file="${tm_file} i386/x86-64.h i386/sol2-bi.h sol2-bi.h"
 		tm_defines="${tm_defines} TARGET_BI_ARCH=1"
-		tmake_file="$tmake_file i386/t-sol2-10"
+		tmake_file="$tmake_file i386/t-sol2-64"
 		need_64bit_hwint=yes
 		need_64bit_isa=yes
-		use_gcc_stdint=wrap
 		case X"${with_cpu}" in
 		Xgeneric|Xatom|Xcore2|Xcorei7|Xcorei7-avx|Xnocona|Xx86-64|Xbdver1|Xbtver1|Xamdfam10|Xbarcelona|Xk8|Xopteron|Xathlon64|Xathlon-fx|Xathlon64-sse3|Xk8-sse3|Xopteron-sse3)
 			;;
@@ -1396,14 +1399,6 @@  i[34567]86-*-solaris2*)
 			;;
 		esac
 		;;
-	*)
-		use_gcc_stdint=provide
-		;;
-	esac
-	case ${enable_threads}:${have_pthread_h}:${have_thread_h} in
-	  "":yes:* | yes:yes:* )
-		thread_file=posix
-		;;
 	esac
 	;;
 i[4567]86-wrs-vxworks|i[4567]86-wrs-vxworksae)
@@ -2479,17 +2474,7 @@  sparc-*-netbsdelf*)
 	extra_options="${extra_options} sparc/long-double-switch.opt"
 	;;
 sparc*-*-solaris2*)
-	tm_file="sparc/biarch64.h ${tm_file} dbxelf.h elfos.h sparc/sysv4.h sol2.h"
-	case ${target} in
-	    *-*-solaris2.1[0-9]*)
-		tm_file="${tm_file} sol2-10.h"
-		use_gcc_stdint=wrap
-		;;
-	    *)
-		use_gcc_stdint=provide
-		;;
-	esac
-	tm_file="${tm_file} sparc/sol2.h"
+	tm_file="sparc/biarch64.h ${tm_file} ${sol2_tm_file} sol2-bi.h"
 	case ${target} in
 	    sparc64-*-* | sparcv9-*-*)
 		tm_file="${tm_file} sparc/sol2-64.h"
@@ -2498,27 +2483,7 @@  sparc*-*-solaris2*)
 		test x$with_cpu != x || with_cpu=v9
 		;;
 	esac
-	tm_file="${tm_file} sparc/sol2-bi.h"
-	if test x$gas = xyes; then
-		tm_file="${tm_file} sparc/sol2-gas.h sparc/sol2-gas-bi.h"
-	fi
-	if test x$gnu_ld = xyes; then
-		tm_file="${tm_file} sol2-gld.h sparc/sol2-gld-bi.h"
-	fi
-	tm_file="${tm_file} tm-dwarf2.h"
-	tmake_file="t-sol2 t-slibgcc-dummy sparc/t-sol2-64"
-	if test x$gas = xyes; then
-		tm_file="usegas.h ${tm_file}"
-	fi
-	c_target_objs="sol2-c.o"
-	cxx_target_objs="sol2-c.o"
-	extra_objs="sol2.o"
-	tm_p_file="${tm_p_file} sol2-protos.h"
-	case ${enable_threads}:${have_pthread_h}:${have_thread_h} in
-	  "":yes:* | yes:yes:* )
-		thread_file=posix
-		;;
-	esac
+	tmake_file="${tmake_file} sparc/t-sol2-64"
 	;;
 sparc-wrs-vxworks)
 	tm_file="${tm_file} elfos.h sparc/sysv4.h vx-common.h vxworks.h sparc/vxworks.h"
diff --git a/gcc/config/i386/sol2-10.h b/gcc/config/i386/sol2-bi.h
rename from gcc/config/i386/sol2-10.h
rename to gcc/config/i386/sol2-bi.h
--- a/gcc/config/i386/sol2-10.h
+++ b/gcc/config/i386/sol2-bi.h
@@ -1,4 +1,4 @@ 
-/* Solaris 10 configuration.
+/* Definitions of target machine for GCC, for bi-arch Solaris 2/x86.
    Copyright (C) 2004, 2006, 2007, 2008, 2009, 2010, 2011
    Free Software Foundation, Inc.
    Contributed by CodeSourcery, LLC.
@@ -19,10 +19,17 @@  You should have received a copy of the G
 along with GCC; see the file COPYING3.  If not see
 <http://www.gnu.org/licenses/>.  */
 
-#undef ASM_COMMENT_START
-#define ASM_COMMENT_START "/"
+/* Override i386/sol2.h version: return 8-byte vectors in MMX registers if
+   possible, matching Sun Studio 12 Update 1+ compilers and other x86
+   targets.  */
+#undef TARGET_SUBTARGET_DEFAULT
+#define TARGET_SUBTARGET_DEFAULT \
+	(MASK_80387 | MASK_IEEE_FP | MASK_FLOAT_RETURNS)
 
-/* binutils' GNU as understands --32 and --64, but the native Solaris
+#define SUBTARGET_OPTIMIZATION_OPTIONS				\
+  { OPT_LEVELS_1_PLUS, OPT_momit_leaf_frame_pointer, NULL, 1 }
+
+/* GNU as understands --32 and --64, but the native Solaris
    assembler requires -xarch=generic or -xarch=generic64 instead.  */
 #undef ASM_SPEC
 #ifdef USE_GAS
@@ -33,6 +40,29 @@  along with GCC; see the file COPYING3.  
 		 "-s %(asm_cpu)"
 #endif
 
+/* We do not need to search a special directory for startup files.  */
+#undef MD_STARTFILE_PREFIX
+
+/* No 64-bit default configurations.  */
+#define DEFAULT_ARCH32_P 1
+
+#define ARCH64_SUBDIR "amd64"
+
+#ifdef USE_GLD
+/* Since binutils 2.21, GNU ld supports new *_sol2 emulations to strictly
+   follow the Solaris 2 ABI.  Prefer them if present.  */
+#ifdef HAVE_LD_SOL2_EMULATION
+#define ARCH32_EMULATION "elf_i386_sol2"
+#define ARCH64_EMULATION "elf_x86_64_sol2"
+#else
+#define ARCH32_EMULATION "elf_i386"
+#define ARCH64_EMULATION "elf_x86_64"
+#endif
+#endif
+
+#undef ASM_COMMENT_START
+#define ASM_COMMENT_START "/"
+
 /* The native Solaris assembler can't calculate the difference between
    symbols in different sections, which causes problems for -fPIC jump
    tables in .rodata.  */
@@ -64,72 +94,10 @@  along with GCC; see the file COPYING3.  
     }									\
   while  (0)
 
+#define USE_IX86_FRAME_POINTER 1
+#define USE_X86_64_FRAME_POINTER 1
+
 #undef NO_PROFILE_COUNTERS
 
 #undef MCOUNT_NAME
 #define MCOUNT_NAME "_mcount"
-
-#undef WCHAR_TYPE
-#define WCHAR_TYPE (TARGET_64BIT ? "int" : "long int")
-#undef WCHAR_TYPE_SIZE
-#define WCHAR_TYPE_SIZE 32
-
-#undef WINT_TYPE
-#define WINT_TYPE (TARGET_64BIT ? "int" : "long int")
-#undef WINT_TYPE_SIZE
-#define WINT_TYPE_SIZE 32
-
-#define USE_IX86_FRAME_POINTER 1
-#define USE_X86_64_FRAME_POINTER 1
-
-/* Override i386/sol2.h version: return 8-byte vectors in MMX registers if
-   possible, matching Sun Studio 12 Update 1+ compilers and other x86
-   targets.  */
-#undef TARGET_SUBTARGET_DEFAULT
-#define TARGET_SUBTARGET_DEFAULT \
-	(MASK_80387 | MASK_IEEE_FP | MASK_FLOAT_RETURNS)
-
-#define SUBTARGET_OPTIMIZATION_OPTIONS				\
-  { OPT_LEVELS_1_PLUS, OPT_momit_leaf_frame_pointer, NULL, 1 }
-
-#define MULTILIB_DEFAULTS { "m32" }
-
-#undef LINK_ARCH64_SPEC_BASE
-#define LINK_ARCH64_SPEC_BASE \
-  "%{G:-G} \
-   %{YP,*} \
-   %{R*} \
-   %{compat-bsd: \
-     %{!YP,*:%{p|pg:-Y P,/usr/ucblib/64:/usr/lib/libp/64:/lib/64:/usr/lib/64} \
-             %{!p:%{!pg:-Y P,/usr/ucblib/64:/lib:/usr/lib/64}}} \
-             -R /usr/ucblib/64} \
-   %{!compat-bsd: \
-     %{!YP,*:%{p|pg:-Y P,/usr/lib/libp/64:/lib/64:/usr/lib/64} \
-             %{!p:%{!pg:-Y P,/lib/64:/usr/lib/64}}}}"
-
-#undef LINK_ARCH64_SPEC
-#define LINK_ARCH64_SPEC LINK_ARCH64_SPEC_BASE
-
-#ifdef TARGET_GNU_LD
-/* Since binutils 2.21, GNU ld supports new *_sol2 emulations to strictly
-   follow the Solaris 2 ABI.  Prefer them if present.  */
-#ifdef HAVE_LD_SOL2_EMULATION
-#define I386_EMULATION "elf_i386_sol2"
-#define X86_64_EMULATION "elf_x86_64_sol2"
-#else
-#define I386_EMULATION "elf_i386"
-#define X86_64_EMULATION "elf_x86_64"
-#endif
-
-#define TARGET_LD_EMULATION "%{m64:-m " X86_64_EMULATION "}" \
-			    "%{!m64:-m " I386_EMULATION "} "
-#else
-#define TARGET_LD_EMULATION ""
-#endif
-
-#undef LINK_ARCH_SPEC
-#define LINK_ARCH_SPEC TARGET_LD_EMULATION \
-		       "%{m64:" LINK_ARCH64_SPEC "}%{!m64:" LINK_ARCH32_SPEC "}"
-
-/* We do not need to search a special directory for startup files.  */
-#undef MD_STARTFILE_PREFIX
diff --git a/gcc/config/i386/sol2-gas.h b/gcc/config/i386/sol2-gas.h
deleted file mode 100644
diff --git a/gcc/config/i386/sol2.h b/gcc/config/i386/sol2.h
--- a/gcc/config/i386/sol2.h
+++ b/gcc/config/i386/sol2.h
@@ -19,6 +19,13 @@  You should have received a copy of the G
 along with GCC; see the file COPYING3.  If not see
 <http://www.gnu.org/licenses/>.  */
 
+/* Augment i386/unix.h version to return 8-byte vectors in memory, matching
+   Sun Studio compilers until version 12, the only ones supported on
+   Solaris 8 and 9.  */
+#undef TARGET_SUBTARGET_DEFAULT
+#define TARGET_SUBTARGET_DEFAULT \
+	(MASK_80387 | MASK_IEEE_FP | MASK_FLOAT_RETURNS | MASK_VECT8_RETURNS)
+
 /* Old versions of the Solaris assembler can not handle the difference of
    labels in different sections, so force DW_EH_PE_datarel.  */
 #undef ASM_PREFERRED_EH_DATA_FORMAT
@@ -37,23 +44,42 @@  along with GCC; see the file COPYING3.  
 #undef EH_TABLES_CAN_BE_READ_ONLY
 #define EH_TABLES_CAN_BE_READ_ONLY (TARGET_64BIT)
 
-/* Solaris 2/Intel as chokes on #line directives.  */
+/* Follow Sun requirements for TLS code sequences and use Sun assembler TLS
+   syntax.  */
+#undef TARGET_SUN_TLS
+#define TARGET_SUN_TLS 1
+
+#undef  SIZE_TYPE
+#define SIZE_TYPE "unsigned int"
+
+#undef  PTRDIFF_TYPE
+#define PTRDIFF_TYPE "int"
+
+/* Solaris 2/Intel as chokes on #line directives before Solaris 10.  */
 #undef CPP_SPEC
 #define CPP_SPEC "%{,assembler-with-cpp:-P} %(cpp_subtarget)"
 
-/* FIXME: Removed -K PIC from generic Solaris 2 ASM_SPEC: the native assembler
-   gives many warnings: R_386_32 relocation is used for symbol ".text".  */
+#define ASM_CPU_SPEC ""
+ 
+/* Removed -K PIC from generic sol2.h ASM_SPEC: the Solaris 8 and 9 assembler
+   gives many warnings: R_386_32 relocation is used for symbol ".text", and
+   GNU as doesn't recognize -K at all.  */
+/* FIXME: Perhaps split between common and CPU-specific parts?  */
 #undef ASM_SPEC
 #define ASM_SPEC "%{v:-V} %{Qy:} %{!Qn:-Qy} %{Ym,*} -s %(asm_cpu)"
 
-#define ASM_CPU_SPEC ""
- 
+#define SUBTARGET_CPU_EXTRA_SPECS \
+  { "cpp_subtarget",	 CPP_SUBTARGET_SPEC },		\
+  { "asm_cpu",		 ASM_CPU_SPEC }
+
 #undef SUBTARGET_EXTRA_SPECS
 #define SUBTARGET_EXTRA_SPECS \
-  { "cpp_subtarget",	CPP_SUBTARGET_SPEC },	\
-  { "asm_cpu",		ASM_CPU_SPEC },		\
-  { "startfile_arch",	STARTFILE_ARCH_SPEC },	\
-  { "link_arch",	LINK_ARCH_SPEC }
+  { "startfile_arch",	STARTFILE_ARCH_SPEC },		\
+  { "link_arch",	LINK_ARCH_SPEC },		\
+  SUBTARGET_CPU_EXTRA_SPECS
+
+/* Register the Solaris-specific #pragma directives.  */
+#define REGISTER_SUBTARGET_PRAGMAS() solaris_register_pragmas ()
 
 #undef LOCAL_LABEL_PREFIX
 #define LOCAL_LABEL_PREFIX "."
@@ -78,18 +104,13 @@  along with GCC; see the file COPYING3.  
       }							\
   } while (0)
 
-/* Follow Sun requirements for TLS code sequences and use Sun assembler TLS
-   syntax.  */
-#undef TARGET_SUN_TLS
-#define TARGET_SUN_TLS 1
-
+#ifndef USE_GAS
 /* The Sun assembler uses .tcomm for TLS common sections.  */
 #define TLS_COMMON_ASM_OP ".tcomm"
 
 /* Similar to the Sun assembler on SPARC, the native assembler requires
    TLS objects to be declared as @tls_obj (not @tls_object).  Unlike SPARC,
    gas doesn't understand this variant.  */
-#ifndef USE_GAS
 #undef  ASM_DECLARE_OBJECT_NAME
 #define ASM_DECLARE_OBJECT_NAME(FILE, NAME, DECL)		\
   do								\
@@ -113,26 +134,7 @@  along with GCC; see the file COPYING3.  
       ASM_OUTPUT_LABEL (FILE, NAME);				\
     }								\
   while (0)
-#endif
-
-/* The Solaris assembler cannot grok .stabd directives.  */
-#undef NO_DBX_BNSYM_ENSYM
-#define NO_DBX_BNSYM_ENSYM 1
-
-/* Solaris-specific #pragmas are implemented on top of attributes.  Hook in
-   the bits from config/sol2.c.  */
-#define SUBTARGET_INSERT_ATTRIBUTES solaris_insert_attributes
-#define SUBTARGET_ATTRIBUTE_TABLE SOLARIS_ATTRIBUTE_TABLE
-
-/* Register the Solaris-specific #pragma directives.  */
-#define REGISTER_SUBTARGET_PRAGMAS() solaris_register_pragmas ()
-
-/* Augment i386/unix.h version to return 8-byte vectors in memory, matching
-   Sun Studio compilers until version 12, the only ones supported on
-   Solaris 8 and 9.  */
-#undef TARGET_SUBTARGET_DEFAULT
-#define TARGET_SUBTARGET_DEFAULT \
-	(MASK_80387 | MASK_IEEE_FP | MASK_FLOAT_RETURNS | MASK_VECT8_RETURNS)
+#endif /* !USE_GAS */
 
 /* Output a simple call for .init/.fini.  */
 #define ASM_OUTPUT_CALL(FILE, FN)				\
@@ -151,12 +153,9 @@  along with GCC; see the file COPYING3.  
 #undef X86_FILE_START_VERSION_DIRECTIVE
 #define X86_FILE_START_VERSION_DIRECTIVE false
 
-/* Static stack checking is supported by means of probes.  */
-#define STACK_CHECK_STATIC_BUILTIN 1
-
 /* Only recent versions of Solaris 11 ld properly support hidden .gnu.linkonce
    sections, so don't use them.  */
-#ifndef TARGET_GNU_LD
+#ifndef USE_GLD
 #define USE_HIDDEN_LINKONCE 0
 #endif
 
@@ -165,9 +164,3 @@  along with GCC; see the file COPYING3.  
 #define LIBGCC2_HAS_TF_MODE 1
 #define LIBGCC2_TF_CEXT q
 #define TF_SIZE 113
-
-#undef  SIZE_TYPE
-#define SIZE_TYPE "unsigned int"
-
-#undef  PTRDIFF_TYPE
-#define PTRDIFF_TYPE "int"
diff --git a/gcc/config/i386/t-sol2-10 b/gcc/config/i386/t-sol2-64
rename from gcc/config/i386/t-sol2-10
rename to gcc/config/i386/t-sol2-64
diff --git a/gcc/config/sol2-10.h b/gcc/config/sol2-10.h
--- a/gcc/config/sol2-10.h
+++ b/gcc/config/sol2-10.h
@@ -1,6 +1,6 @@ 
 /* Operating system specific defines to be used when targeting GCC for any
    Solaris 2 system starting from Solaris 10.
-   Copyright 2006, 2007 Free Software Foundation, Inc.
+   Copyright 2006, 2007, 2011 Free Software Foundation, Inc.
 
 This file is part of GCC.
 
@@ -19,5 +19,4 @@  along with GCC; see the file COPYING3.  
 <http://www.gnu.org/licenses/>.  */
 
 /* Solaris 10 has the float and long double forms of math functions.  */
-#undef TARGET_C99_FUNCTIONS
 #define TARGET_C99_FUNCTIONS 1
diff --git a/gcc/config/sol2-bi.h b/gcc/config/sol2-bi.h
new file mode 100644
--- /dev/null
+++ b/gcc/config/sol2-bi.h
@@ -0,0 +1,119 @@ 
+/* Definitions of target machine for GCC, for bi-arch Solaris 2.
+   Copyright (C) 2011 Free Software Foundation, Inc.
+
+   This file is part of GCC.
+
+   GCC is free software; you can redistribute it and/or modify it under
+   the terms of the GNU General Public License as published by the Free
+   Software Foundation; either version 3, or (at your option) any later
+   version.
+
+   GCC is distributed in the hope that it will be useful, but WITHOUT ANY
+   WARRANTY; without even the implied warranty of MERCHANTABILITY or
+   FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+   for more details.
+
+   Under Section 7 of GPL version 3, you are granted additional
+   permissions described in the GCC Runtime Library Exception, version
+   3.1, as published by the Free Software Foundation.
+
+   You should have received a copy of the GNU General Public License and
+   a copy of the GCC Runtime Library Exception along with this program;
+   see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
+   <http://www.gnu.org/licenses/>.  */
+
+/* wchar_t is called differently in <wchar.h> for 32 and 64-bit
+   compilations.  This is called for by SCD 2.4.1, p. 6-83, Figure 6-65
+   (32-bit) and p. 6P-10, Figure 6.38 (64-bit).  */
+
+#undef WCHAR_TYPE
+#define WCHAR_TYPE (TARGET_64BIT ? "int" : "long int")
+
+#undef WCHAR_TYPE_SIZE
+#define WCHAR_TYPE_SIZE 32
+
+/* Same for wint_t.  See SCD 2.4.1, p. 6-83, Figure 6-66 (32-bit).  There's
+   no corresponding 64-bit definition, but this is what Solaris 8
+   <iso/wchar_iso.h> uses.  */
+
+#undef WINT_TYPE
+#define WINT_TYPE (TARGET_64BIT ? "int" : "long int")
+
+#undef WINT_TYPE_SIZE
+#define WINT_TYPE_SIZE 32
+
+#if DEFAULT_ARCH32_P
+#define MULTILIB_DEFAULTS { "m32" }
+#else
+#define MULTILIB_DEFAULTS { "m64" }
+#endif
+
+#if DEFAULT_ARCH32_P
+#define DEF_ARCH32_SPEC(__str) "%{!m64:" __str "}"
+#define DEF_ARCH64_SPEC(__str) "%{m64:" __str "}"
+#else
+#define DEF_ARCH32_SPEC(__str) "%{m32:" __str "}"
+#define DEF_ARCH64_SPEC(__str) "%{!m32:" __str "}"
+#endif
+
+/* This should be the same as LINK_ARCH32_SPEC_BASE, except with
+   ARCH64_SUBDIR appended to the paths and /usr/ccs/lib is no longer
+   necessary.  */
+#undef LINK_ARCH64_SPEC_BASE
+#define LINK_ARCH64_SPEC_BASE \
+  "%{G:-G} \
+   %{YP,*} \
+   %{R*} \
+   %{!YP,*:%{p|pg:-Y P,%R/usr/lib/libp/" ARCH64_SUBDIR ":%R/lib/" ARCH64_SUBDIR ":%R/usr/lib/" ARCH64_SUBDIR "}	\
+	   %{!p:%{!pg:-Y P,%R/lib/" ARCH64_SUBDIR ":%R/usr/lib/" ARCH64_SUBDIR "}}}"
+
+#undef LINK_ARCH64_SPEC
+#ifndef USE_GLD
+/* FIXME: Used to be SPARC-only.  Not SPARC-specfic but for the model name!  */
+#define LINK_ARCH64_SPEC \
+  "%{mcmodel=medlow:-M /usr/lib/ld/" ARCH64_SUBDIR "/map.below4G} " \
+  LINK_ARCH64_SPEC_BASE
+#else
+#define LINK_ARCH64_SPEC LINK_ARCH64_SPEC_BASE
+#endif
+
+#ifdef USE_GLD
+#define TARGET_LD_EMULATION "%{m32:-m " ARCH32_EMULATION "}" \
+			    "%{m64:-m " ARCH64_EMULATION "} "
+#else
+#define TARGET_LD_EMULATION ""
+#endif
+
+#undef LINK_ARCH_SPEC
+#if DISABLE_MULTILIB
+#if DEFAULT_ARCH32_P
+#define LINK_ARCH_SPEC TARGET_LD_EMULATION " \
+%{m32:%(link_arch32)} \
+%{m64:%edoes not support multilib} \
+%{!m32:%{!m64:%(link_arch_default)}} \
+"
+#else
+#define LINK_ARCH_SPEC TARGET_LD_EMULATION " \
+%{m32:%edoes not support multilib} \
+%{m64:%(link_arch64)} \
+%{!m32:%{!m64:%(link_arch_default)}} \
+"
+#endif
+#else
+#define LINK_ARCH_SPEC TARGET_LD_EMULATION " \
+%{m32:%(link_arch32)} \
+%{m64:%(link_arch64)} \
+%{!m32:%{!m64:%(link_arch_default)}}"
+#endif
+
+#define LINK_ARCH_DEFAULT_SPEC \
+(DEFAULT_ARCH32_P ? LINK_ARCH32_SPEC : LINK_ARCH64_SPEC)
+
+#undef SUBTARGET_EXTRA_SPECS
+#define SUBTARGET_EXTRA_SPECS \
+  { "startfile_arch",	 STARTFILE_ARCH_SPEC },		\
+  { "link_arch32",       LINK_ARCH32_SPEC },            \
+  { "link_arch64",       LINK_ARCH64_SPEC },            \
+  { "link_arch_default", LINK_ARCH_DEFAULT_SPEC },	\
+  { "link_arch",	 LINK_ARCH_SPEC },		\
+  SUBTARGET_CPU_EXTRA_SPECS
diff --git a/gcc/config/sol2-gld.h b/gcc/config/sol2-gld.h
deleted file mode 100644
diff --git a/gcc/config/sol2.h b/gcc/config/sol2.h
--- a/gcc/config/sol2.h
+++ b/gcc/config/sol2.h
@@ -22,11 +22,6 @@  along with GCC; see the file COPYING3.  
 /* We are compiling for Solaris 2 now.  */
 #define TARGET_SOLARIS 1
 
-/* We use stabs-in-elf for debugging, because that is what the native
-   toolchain uses.  */
-#undef PREFERRED_DEBUGGING_TYPE
-#define PREFERRED_DEBUGGING_TYPE DBX_DEBUG
-
 /* Solaris 2 (at least as of 2.5.1) uses a 32-bit wchar_t.  */
 #undef WCHAR_TYPE
 #define WCHAR_TYPE "long int"
@@ -76,15 +71,9 @@  along with GCC; see the file COPYING3.  
 #define INTPTR_TYPE (LONG_TYPE_SIZE == 64 ? "long int" : "int")
 #define UINTPTR_TYPE (LONG_TYPE_SIZE == 64 ? "long unsigned int" : "unsigned int")
 
-/* ??? Note: in order for -compat-bsd to work fully,
-   we must somehow arrange to fixincludes /usr/ucbinclude
-   and put the result in $(libsubdir)/ucbinclude.  */
-
 #undef CPP_SUBTARGET_SPEC
 #define CPP_SUBTARGET_SPEC "\
-%{pthreads|pthread:-D_REENTRANT -D_PTHREADS} \
-%{compat-bsd:-iwithprefixbefore ucbinclude -I/usr/ucbinclude} \
-"
+%{pthreads|pthread:-D_REENTRANT -D_PTHREADS}"
 
 /* Names to predefine in the preprocessor for this target machine.  */
 #define TARGET_SUB_OS_CPP_BUILTINS()
@@ -110,9 +99,6 @@  along with GCC; see the file COPYING3.  
 	TARGET_SUB_OS_CPP_BUILTINS();			\
     } while (0)
 
-/* The system headers under Solaris 2 are C++-aware since 2.0.  */
-#define NO_IMPLICIT_EXTERN_C
-
 /* It's safe to pass -s always, even if -g is not used.  */
 #undef ASM_SPEC
 #define ASM_SPEC "\
@@ -121,6 +107,15 @@  along with GCC; see the file COPYING3.  
 %(asm_cpu) \
 "
 
+#undef LIB_SPEC
+#define LIB_SPEC \
+  "%{!symbolic:\
+     %{pthreads|pthread:" \
+        LIB_THREAD_LDFLAGS_SPEC " -lpthread " LIB_TLS_SPEC "} \
+     %{fprofile-generate*:" \
+        LIB_THREAD_LDFLAGS_SPEC " " LIB_TLS_SPEC "} \
+     %{p|pg:-ldl} -lc}"
+
 #ifndef CROSS_DIRECTORY_STRUCTURE
 #undef MD_EXEC_PREFIX
 #define MD_EXEC_PREFIX "/usr/ccs/bin/"
@@ -129,21 +124,12 @@  along with GCC; see the file COPYING3.  
 #define MD_STARTFILE_PREFIX "/usr/ccs/lib/"
 #endif
 
-/* We don't use the standard LIB_SPEC only because we don't yet support c++.  */
-#undef LIB_SPEC
-#define LIB_SPEC \
-  "%{compat-bsd:-lucb -lsocket -lnsl -lelf -laio} \
-   %{!symbolic:\
-     %{pthreads|pthread:" \
-        LIB_THREAD_LDFLAGS_SPEC " -lpthread " LIB_TLS_SPEC "} \
-     %{fprofile-generate*:" \
-        LIB_THREAD_LDFLAGS_SPEC " " LIB_TLS_SPEC "} \
-     %{p|pg:-ldl} -lc}"
+#undef STARTFILE_ARCH32_SPEC
+#define STARTFILE_ARCH32_SPEC "%{ansi:values-Xc.o%s} \
+			    %{!ansi:values-Xa.o%s}"
 
-#undef  ENDFILE_SPEC
-#define ENDFILE_SPEC \
-  "%{Ofast|ffast-math|funsafe-math-optimizations:crtfastmath.o%s} \
-   crtend.o%s crtn.o%s"
+#undef STARTFILE_ARCH_SPEC
+#define STARTFILE_ARCH_SPEC STARTFILE_ARCH32_SPEC
 
 /* We don't use the standard svr4 STARTFILE_SPEC because it's wrong for us.  */
 #undef STARTFILE_SPEC
@@ -156,25 +142,18 @@  along with GCC; see the file COPYING3.  
 			crti.o%s %(startfile_arch) \
 			crtbegin.o%s"
 
-#undef STARTFILE_ARCH32_SPEC
-#define STARTFILE_ARCH32_SPEC "%{ansi:values-Xc.o%s} \
-			    %{!ansi:values-Xa.o%s}"
-
-#undef STARTFILE_ARCH_SPEC
-#define STARTFILE_ARCH_SPEC STARTFILE_ARCH32_SPEC
+#undef  ENDFILE_SPEC
+#define ENDFILE_SPEC \
+  "%{Ofast|ffast-math|funsafe-math-optimizations:crtfastmath.o%s} \
+   crtend.o%s crtn.o%s"
 
 #undef LINK_ARCH32_SPEC_BASE
 #define LINK_ARCH32_SPEC_BASE \
   "%{G:-G} \
    %{YP,*} \
    %{R*} \
-   %{compat-bsd: \
-     %{!YP,*:%{p|pg:-Y P,%R/usr/ucblib:%R/usr/ccs/lib/libp:%R/usr/lib/libp:%R/usr/ccs/lib:%R/usr/lib} \
-             %{!p:%{!pg:-Y P,%R/usr/ucblib:%R/usr/ccs/lib:%R/usr/lib}}} \
-             -R %R/usr/ucblib} \
-   %{!compat-bsd: \
-     %{!YP,*:%{p|pg:-Y P,%R/usr/ccs/lib/libp:%R/usr/lib/libp:%R/usr/ccs/lib:%R/usr/lib} \
-             %{!p:%{!pg:-Y P,%R/usr/ccs/lib:%R/usr/lib}}}}"
+   %{!YP,*:%{p|pg:-Y P,%R/usr/ccs/lib/libp:%R/usr/lib/libp:%R/usr/ccs/lib:%R/lib:%R/usr/lib} \
+	   %{!p:%{!pg:-Y P,%R/usr/ccs/lib:%R/lib:%R/usr/lib}}}"
 
 #undef LINK_ARCH32_SPEC
 #define LINK_ARCH32_SPEC LINK_ARCH32_SPEC_BASE
@@ -182,6 +161,14 @@  along with GCC; see the file COPYING3.  
 #undef LINK_ARCH_SPEC
 #define LINK_ARCH_SPEC LINK_ARCH32_SPEC
 
+#ifndef USE_GLD
+/* With Sun ld, -rdynamic is a no-op.  */
+#define RDYNAMIC_SPEC ""
+#else
+/* GNU ld needs --export-dynamic to implement -rdynamic.  */
+#define RDYNAMIC_SPEC "--export-dynamic"
+#endif
+
 #undef  LINK_SPEC
 #define LINK_SPEC \
   "%{h*} %{v:-V} \
@@ -192,22 +179,22 @@  along with GCC; see the file COPYING3.  
    %(link_arch) \
    %{Qy:} %{!Qn:-Qy}"
 
-/* With Sun ld, -rdynamic is a no-op.  */
-#define RDYNAMIC_SPEC ""
-
-/* The Solaris linker doesn't understand constructor priorities.  (The
-   GNU linker does support constructor priorities, so GNU ld
-   configuration files for Solaris override this setting.)  */
-#undef SUPPORTS_INIT_PRIORITY
-#define SUPPORTS_INIT_PRIORITY 0
+#ifdef USE_GLD
+/* Solaris 11 build 135+ implements dl_iterate_phdr.  GNU ld needs
+   --eh-frame-hdr to create the required .eh_frame_hdr sections.  */
+#if defined(HAVE_LD_EH_FRAME_HDR) && defined(TARGET_DL_ITERATE_PHDR)
+#define LINK_EH_SPEC "%{!static:--eh-frame-hdr} "
+#endif /* HAVE_LD_EH_FRAME && TARGET_DL_ITERATE_PHDR */
+#endif
 
 /* collect2.c can only parse GNU nm -n output.  Solaris nm needs -png to
    produce the same format.  */
 #define NM_FLAGS "-png"
+
+/* The system headers under Solaris 2 are C++-aware since 2.0.  */
+#define NO_IMPLICIT_EXTERN_C
 
 #define STDC_0_IN_SYSTEM_HEADERS 1
-
-#define HAVE_ENABLE_EXECUTE_STACK
 
 /* Support Solaris-specific format checking for cmn_err.  */
 #define TARGET_N_FORMAT_TYPES 1
@@ -219,6 +206,14 @@  along with GCC; see the file COPYING3.  
   { "init",      0, 0, true,  false,  false, NULL, false },		\
   { "fini",      0, 0, true,  false,  false, NULL, false }
 
+/* Solaris-specific #pragmas are implemented on top of attributes.  Hook in
+   the bits from config/sol2.c.  */
+#define SUBTARGET_INSERT_ATTRIBUTES solaris_insert_attributes
+#define SUBTARGET_ATTRIBUTE_TABLE SOLARIS_ATTRIBUTE_TABLE
+
+/* Allow macro expansion in #pragma pack.  */
+#define HANDLE_PRAGMA_PACK_WITH_EXPANSION
+
 /* Solaris/x86 as and gas support unquoted section names.  */
 #define SECTION_NAME_FORMAT	"%s"
 
@@ -234,7 +229,7 @@  along with GCC; see the file COPYING3.  
     }								\
   while (0)
 
-/* Solaris 'as' has a bug: a .common directive in .tbss or .tdata section
+/* Solaris as has a bug: a .common directive in .tbss or .tdata section
    behaves as .tls_common rather than normal non-TLS .common.  */
 #undef  ASM_OUTPUT_ALIGNED_COMMON
 #define ASM_OUTPUT_ALIGNED_COMMON(FILE, NAME, SIZE, ALIGN)		\
@@ -257,13 +252,25 @@  along with GCC; see the file COPYING3.  
 
 #define AS_NEEDS_DASH_FOR_PIPED_INPUT
 
+/* The Solaris assembler cannot grok .stabd directives.  */
+#undef NO_DBX_BNSYM_ENSYM
+#define NO_DBX_BNSYM_ENSYM 1
 #endif
 
+#ifndef USE_GLD
+/* The Solaris linker doesn't understand constructor priorities.  */
+#undef SUPPORTS_INIT_PRIORITY
+#define SUPPORTS_INIT_PRIORITY 0
+#endif
+
+/* Solaris has an implementation of __enable_execute_stack.  */
+#define HAVE_ENABLE_EXECUTE_STACK
+
+/* Static stack checking is supported by means of probes.  */
+#define STACK_CHECK_STATIC_BUILTIN 1
+
+#define TARGET_POSIX_IO
+
 extern GTY(()) tree solaris_pending_aligns;
 extern GTY(()) tree solaris_pending_inits;
 extern GTY(()) tree solaris_pending_finis;
-
-/* Allow macro expansion in #pragma pack.  */
-#define HANDLE_PRAGMA_PACK_WITH_EXPANSION
-
-#define TARGET_POSIX_IO
diff --git a/gcc/config/sol2.opt b/gcc/config/sol2.opt
--- a/gcc/config/sol2.opt
+++ b/gcc/config/sol2.opt
@@ -27,9 +27,6 @@  Driver Joined
 Ym,
 Driver Joined
 
-compat-bsd
-Driver
-
 mimpure-text
 Target Report
 Pass -z text to linker
diff --git a/gcc/config/sparc/sol2-bi.h b/gcc/config/sparc/sol2-bi.h
deleted file mode 100644
diff --git a/gcc/config/sparc/sol2-gas-bi.h b/gcc/config/sparc/sol2-gas-bi.h
deleted file mode 100644
diff --git a/gcc/config/sparc/sol2-gas.h b/gcc/config/sparc/sol2-gas.h
deleted file mode 100644
diff --git a/gcc/config/sparc/sol2-gld-bi.h b/gcc/config/sparc/sol2-gld-bi.h
deleted file mode 100644
diff --git a/gcc/config/sparc/sol2.h b/gcc/config/sparc/sol2.h
--- a/gcc/config/sparc/sol2.h
+++ b/gcc/config/sparc/sol2.h
@@ -20,62 +20,240 @@  You should have received a copy of the G
 along with GCC; see the file COPYING3.  If not see
 <http://www.gnu.org/licenses/>.  */
 
+/* Solaris allows 64 bit out and global registers in 32 bit mode.
+   sparc_override_options will disable V8+ if not generating V9 code.  */
+#undef TARGET_DEFAULT
+#define TARGET_DEFAULT (MASK_V8PLUS + MASK_APP_REGS + MASK_FPU \
+			+ MASK_LONG_DOUBLE_128)
+
+/* The default code model used to be CM_MEDANY on Solaris
+   but even Sun eventually found it to be quite wasteful
+   and changed it to CM_MEDMID in the Studio 9 compiler.  */
+#undef SPARC_DEFAULT_CMODEL
+#define SPARC_DEFAULT_CMODEL CM_MEDMID
+
+/* Select a format to encode pointers in exception handling data.  CODE
+   is 0 for data, 1 for code labels, 2 for function pointers.  GLOBAL is
+   true if the symbol may be affected by dynamic relocations.
+
+   Some Solaris dynamic linkers don't handle unaligned section relative
+   relocs properly, so force them to be aligned.  */
+#ifndef HAVE_AS_SPARC_UA_PCREL
+#define ASM_PREFERRED_EH_DATA_FORMAT(CODE,GLOBAL)		\
+  ((flag_pic || GLOBAL) ? DW_EH_PE_aligned : DW_EH_PE_absptr)
+#endif
+
+
+
 /* Supposedly the same as vanilla sparc svr4, except for the stuff below: */
 
 /* This is here rather than in sparc.h because it's not known what
    other assemblers will accept.  */
 
+#ifndef USE_GAS
+#define AS_SPARC64_FLAG	"-xarch=v9"
+#else
+#define AS_SPARC64_FLAG	"-TSO -64 -Av9"
+#endif
+
+#undef ASM_CPU32_DEFAULT_SPEC
+#define ASM_CPU32_DEFAULT_SPEC	""
+#undef ASM_CPU64_DEFAULT_SPEC
+#define ASM_CPU64_DEFAULT_SPEC	AS_SPARC64_FLAG
+
 #if TARGET_CPU_DEFAULT == TARGET_CPU_v9
+#undef CPP_CPU64_DEFAULT_SPEC
+#define CPP_CPU64_DEFAULT_SPEC ""
+#undef ASM_CPU32_DEFAULT_SPEC
+#define ASM_CPU32_DEFAULT_SPEC "-xarch=v8plus"
 #undef ASM_CPU_DEFAULT_SPEC
-#define ASM_CPU_DEFAULT_SPEC "-xarch=v8plus"
+#define ASM_CPU_DEFAULT_SPEC ASM_CPU32_DEFAULT_SPEC
 #endif
 
 #if TARGET_CPU_DEFAULT == TARGET_CPU_ultrasparc
+#undef CPP_CPU64_DEFAULT_SPEC
+#define CPP_CPU64_DEFAULT_SPEC ""
+#undef ASM_CPU32_DEFAULT_SPEC
+#define ASM_CPU32_DEFAULT_SPEC "-xarch=v8plusa"
+#undef ASM_CPU64_DEFAULT_SPEC
+#define ASM_CPU64_DEFAULT_SPEC AS_SPARC64_FLAG "a"
 #undef ASM_CPU_DEFAULT_SPEC
-#define ASM_CPU_DEFAULT_SPEC "-xarch=v8plusa"
+#define ASM_CPU_DEFAULT_SPEC ASM_CPU32_DEFAULT_SPEC
 #endif
 
 #if TARGET_CPU_DEFAULT == TARGET_CPU_ultrasparc3
+#undef CPP_CPU64_DEFAULT_SPEC
+#define CPP_CPU64_DEFAULT_SPEC ""
+#undef ASM_CPU32_DEFAULT_SPEC
+#define ASM_CPU32_DEFAULT_SPEC "-xarch=v8plusb"
+#undef ASM_CPU64_DEFAULT_SPEC
+#define ASM_CPU64_DEFAULT_SPEC AS_SPARC64_FLAG "b"
 #undef ASM_CPU_DEFAULT_SPEC
-#define ASM_CPU_DEFAULT_SPEC "-xarch=v8plusb"
+#define ASM_CPU_DEFAULT_SPEC ASM_CPU32_DEFAULT_SPEC
 #endif
 
 #if TARGET_CPU_DEFAULT == TARGET_CPU_niagara
+#undef CPP_CPU64_DEFAULT_SPEC
+#define CPP_CPU64_DEFAULT_SPEC ""
+#undef ASM_CPU32_DEFAULT_SPEC
+#define ASM_CPU32_DEFAULT_SPEC "-xarch=v8plusb"
+#undef ASM_CPU64_DEFAULT_SPEC
+#define ASM_CPU64_DEFAULT_SPEC AS_SPARC64_FLAG "b"
 #undef ASM_CPU_DEFAULT_SPEC
-#define ASM_CPU_DEFAULT_SPEC "-xarch=v8plusb"
+#define ASM_CPU_DEFAULT_SPEC ASM_CPU32_DEFAULT_SPEC
 #endif
 
 #if TARGET_CPU_DEFAULT == TARGET_CPU_niagara2
+#undef CPP_CPU64_DEFAULT_SPEC
+#define CPP_CPU64_DEFAULT_SPEC ""
+#undef ASM_CPU32_DEFAULT_SPEC
+#define ASM_CPU32_DEFAULT_SPEC "-xarch=v8plusb"
+#undef ASM_CPU64_DEFAULT_SPEC
+#define ASM_CPU64_DEFAULT_SPEC AS_SPARC64_FLAG "b"
 #undef ASM_CPU_DEFAULT_SPEC
-#define ASM_CPU_DEFAULT_SPEC "-xarch=v8plusb"
+#define ASM_CPU_DEFAULT_SPEC ASM_CPU32_DEFAULT_SPEC
+#endif
+
+#undef CPP_CPU_SPEC
+#define CPP_CPU_SPEC "\
+%{mcpu=sparclet|mcpu=tsc701:-D__sparclet__} \
+%{mcpu=sparclite|mcpu-f930|mcpu=f934:-D__sparclite__} \
+%{mcpu=v8:" DEF_ARCH32_SPEC("-D__sparcv8") "} \
+%{mcpu=supersparc:-D__supersparc__ " DEF_ARCH32_SPEC("-D__sparcv8") "} \
+%{mcpu=v9|mcpu=ultrasparc|mcpu=ultrasparc3|mcpu=niagara|mcpu=niagara2:" DEF_ARCH32_SPEC("-D__sparcv8") "} \
+%{!mcpu*:%(cpp_cpu_default)} \
+"
+
+#undef CPP_CPU_DEFAULT_SPEC
+#define CPP_CPU_DEFAULT_SPEC \
+(DEFAULT_ARCH32_P ? "\
+%{m64:" CPP_CPU64_DEFAULT_SPEC "} \
+%{!m64:" CPP_CPU32_DEFAULT_SPEC "} \
+" : "\
+%{m32:" CPP_CPU32_DEFAULT_SPEC "} \
+%{!m32:" CPP_CPU64_DEFAULT_SPEC "} \
+")
+
+#undef CPP_ARCH32_SPEC
+#define CPP_ARCH32_SPEC ""
+#undef CPP_ARCH64_SPEC
+#define CPP_ARCH64_SPEC "-D__arch64__ -D__sparcv9"
+
+#undef CPP_ARCH_SPEC
+#define CPP_ARCH_SPEC "\
+%{m32:%(cpp_arch32)} \
+%{m64:%(cpp_arch64)} \
+%{!m32:%{!m64:%(cpp_arch_default)}} \
+"
+
+#undef	CC1_SPEC
+#if DEFAULT_ARCH32_P
+#define CC1_SPEC "\
+%{m64:%{m32:%emay not use both -m32 and -m64}} \
+%{m64:-mptr64 -mstack-bias -mno-v8plus \
+  %{!mcpu*:-%{!mv8plus:mcpu=v9}}} \
+"
+#else
+#define CC1_SPEC "\
+%{m32:%{m64:%emay not use both -m32 and -m64}} \
+%{m32:-mptr32 -mno-stack-bias \
+  %{!mcpu*:%{!mv8plus:-mcpu=v9}}} \
+%{mv8plus:-m32 -mptr32 -mno-stack-bias \
+  %{!mcpu*:-mcpu=v9}} \
+"
+#endif
+
+/* Support for a compile-time default CPU, et cetera.  The rules are:
+   --with-cpu is ignored if -mcpu is specified.
+   --with-tune is ignored if -mtune is specified.
+   --with-float is ignored if -mhard-float, -msoft-float, -mfpu, or -mno-fpu
+     are specified.
+   In the SPARC_BI_ARCH compiler we cannot pass %{!mcpu=*:-mcpu=%(VALUE)}
+   here, otherwise say -mcpu=v7 would be passed even when -m64.
+   CC1_SPEC above takes care of this instead.  */
+#undef OPTION_DEFAULT_SPECS
+#if DEFAULT_ARCH32_P
+#define OPTION_DEFAULT_SPECS \
+  {"cpu", "%{!m64:%{!mcpu=*:-mcpu=%(VALUE)}}" }, \
+  {"tune", "%{!mtune=*:-mtune=%(VALUE)}" }, \
+  {"float", "%{!msoft-float:%{!mhard-float:%{!mfpu:%{!mno-fpu:-m%(VALUE)-float}}}}" }
+#else
+#define OPTION_DEFAULT_SPECS \
+  {"cpu", "%{!m32:%{!mcpu=*:-mcpu=%(VALUE)}}" }, \
+  {"tune", "%{!mtune=*:-mtune=%(VALUE)}" }, \
+  {"float", "%{!msoft-float:%{!mhard-float:%{!mfpu:%{!mno-fpu:-m%(VALUE)-float}}}}" }
 #endif
 
 #undef ASM_CPU_SPEC
 #define ASM_CPU_SPEC "\
-%{mcpu=v9:-xarch=v8plus} \
-%{mcpu=ultrasparc:-xarch=v8plusa} \
-%{mcpu=ultrasparc3:-xarch=v8plusb} \
-%{mcpu=niagara:-xarch=v8plusb} \
-%{mcpu=niagara2:-xarch=v8plusb} \
+%{mcpu=v9:" DEF_ARCH32_SPEC("-xarch=v8plus") DEF_ARCH64_SPEC(AS_SPARC64_FLAG) "} \
+%{mcpu=ultrasparc:" DEF_ARCH32_SPEC("-xarch=v8plusa") DEF_ARCH64_SPEC(AS_SPARC64_FLAG "a") "} \
+%{mcpu=ultrasparc3:" DEF_ARCH32_SPEC("-xarch=v8plusb") DEF_ARCH64_SPEC(AS_SPARC64_FLAG "b") "} \
+%{mcpu=niagara:" DEF_ARCH32_SPEC("-xarch=v8plusb") DEF_ARCH64_SPEC(AS_SPARC64_FLAG "b") "} \
+%{mcpu=niagara2:" DEF_ARCH32_SPEC("-xarch=v8plusb") DEF_ARCH64_SPEC(AS_SPARC64_FLAG "b") "} \
+%{!mcpu=niagara2:%{!mcpu=niagara:%{!mcpu=ultrasparc3:%{!mcpu=ultrasparc:%{!mcpu=v9:%{mcpu*:" DEF_ARCH32_SPEC("-xarch=v8") DEF_ARCH64_SPEC(AS_SPARC64_FLAG) "}}}}}} \
 %{!mcpu*:%(asm_cpu_default)} \
 "
 
-#undef SUBTARGET_EXTRA_SPECS
-#define SUBTARGET_EXTRA_SPECS \
-  { "startfile_arch",	STARTFILE_ARCH_SPEC },	\
-  { "link_arch",	LINK_ARCH_SPEC }
+#undef ASM_CPU_DEFAULT_SPEC
+#define ASM_CPU_DEFAULT_SPEC \
+(DEFAULT_ARCH32_P ? "\
+%{m64:" ASM_CPU64_DEFAULT_SPEC "} \
+%{!m64:" ASM_CPU32_DEFAULT_SPEC "} \
+" : "\
+%{m32:" ASM_CPU32_DEFAULT_SPEC "} \
+%{!m32:" ASM_CPU64_DEFAULT_SPEC "} \
+")
 
-/* However it appears that Solaris 2.0 uses the same reg numbering as
-   the old BSD-style system did.  */
+#undef ASM_ARCH32_SPEC
+#define ASM_ARCH32_SPEC ""
+
+#undef ASM_ARCH64_SPEC
+#define ASM_ARCH64_SPEC ""
+
+#undef ASM_ARCH_DEFAULT_SPEC
+#define ASM_ARCH_DEFAULT_SPEC ""
+
+#undef ASM_ARCH_SPEC
+#define ASM_ARCH_SPEC ""
+
+#ifdef USE_GLD
+/* Since binutils 2.21, GNU ld supports new *_sol2 emulations to strictly
+   follow the Solaris 2 ABI.  Prefer them if present.  */
+#ifdef HAVE_LD_SOL2_EMULATION
+#define ARCH32_EMULATION "elf32_sparc_sol2"
+#define ARCH64_EMULATION "elf64_sparc_sol2"
+#else
+#define ARCH32_EMULATION "elf32_sparc"
+#define ARCH64_EMULATION "elf64_sparc"
+#endif
+#endif
+
+#define ARCH64_SUBDIR "sparcv9"
+
+#define SUBTARGET_CPU_EXTRA_SPECS
+
+
+
+/* Register the Solaris-specific #pragma directives.  */
+#define REGISTER_TARGET_PRAGMAS() solaris_register_pragmas ()
+
+#if defined(USE_GAS) && defined(HAVE_AS_TLS)
+/* Use GNU extensions to TLS support.  */
+#undef TARGET_SUN_TLS
+#undef TARGET_GNU_TLS
+#define TARGET_SUN_TLS 0
+#define TARGET_GNU_TLS 1
+#endif
+
+#undef  LOCAL_LABEL_PREFIX
+#define LOCAL_LABEL_PREFIX  "."
 
 /* The Solaris 2 assembler uses .skip, not .zero, so put this back.  */
 #undef ASM_OUTPUT_SKIP
 #define ASM_OUTPUT_SKIP(FILE,SIZE)  \
   fprintf (FILE, "\t.skip %u\n", (int)(SIZE))
 
-#undef  LOCAL_LABEL_PREFIX
-#define LOCAL_LABEL_PREFIX  "."
-
 /* This is how to store into the string LABEL
    the symbol_ref name of an internal numbered label where
    PREFIX is the class of label and NUM is the number within the class.
@@ -87,7 +265,7 @@  along with GCC; see the file COPYING3.  
 
 /* The native TLS-enabled assembler requires the directive #tls_object
    to be put on objects in TLS sections (as of v7.1).  This is not
-   required by the GNU assembler but supported on SPARC.  */
+   required by GNU as but supported on SPARC.  */
 #undef  ASM_DECLARE_OBJECT_NAME
 #define ASM_DECLARE_OBJECT_NAME(FILE, NAME, DECL)		\
   do								\
@@ -112,23 +290,47 @@  along with GCC; see the file COPYING3.  
     }								\
   while (0)
 
-/* The Solaris assembler cannot grok .stabd directives.  */
-#undef NO_DBX_BNSYM_ENSYM
-#define NO_DBX_BNSYM_ENSYM 1
-
+/* Output a simple call for .init/.fini.  */
+#define ASM_OUTPUT_CALL(FILE, FN)				        \
+  do									\
+    {									\
+      fprintf (FILE, "\tcall\t");					\
+      targetm.asm_out.print_operand (FILE, XEXP (DECL_RTL (FN), 0), 0);	\
+      fprintf (FILE, "\n\tnop\n");					\
+    }									\
+  while (0)
 
-/* Select a format to encode pointers in exception handling data.  CODE
-   is 0 for data, 1 for code labels, 2 for function pointers.  GLOBAL is
-   true if the symbol may be affected by dynamic relocations.
+#ifndef USE_GAS
+/* This is how to output an assembler line that says to advance
+   the location counter to a multiple of 2**LOG bytes using the
+   NOP instruction as padding.  The filler pattern doesn't work
+   with GNU as. */
+#define ASM_OUTPUT_ALIGN_WITH_NOP(FILE,LOG)   \
+  if ((LOG) != 0)                             \
+    fprintf (FILE, "\t.align %d,0x1000000\n", (1<<(LOG)))
 
-   Some Solaris dynamic linkers don't handle unaligned section relative
-   relocs properly, so force them to be aligned.  */
-#ifndef HAVE_AS_SPARC_UA_PCREL
-#define ASM_PREFERRED_EH_DATA_FORMAT(CODE,GLOBAL)		\
-  ((flag_pic || GLOBAL) ? DW_EH_PE_aligned : DW_EH_PE_absptr)
+/* Use Solaris ELF section syntax with Sun as.  */
+#undef TARGET_ASM_NAMED_SECTION
+#define TARGET_ASM_NAMED_SECTION sparc_solaris_elf_asm_named_section
+
+/* Emit COMDAT group signature symbols for Sun as.  */
+#undef TARGET_ASM_CODE_END
+#define TARGET_ASM_CODE_END solaris_code_end
+
+/* Sun as requires doublequoted section names on SPARC.  While GNU as
+   supports that, too, we prefer the standard variant.  */
+#undef SECTION_NAME_FORMAT
+#define SECTION_NAME_FORMAT	"\"%s\""
+#endif /* !USE_GAS */
+
+/* Undefine this so that attribute((init_priority)) works with GNU ld.  */
+#ifdef USE_GLD
+#undef CTORS_SECTION_ASM_OP
+#undef DTORS_SECTION_ASM_OP
 #endif
 
 
+
 /* Define for support of TFmode long double.
    SPARC ABI says that long double is 4 words.  */
 #define LONG_DOUBLE_TYPE_SIZE 128
@@ -147,52 +349,3 @@  along with GCC; see the file COPYING3.  
 
 #undef SUN_INTEGER_MULTIPLY_64
 #define SUN_INTEGER_MULTIPLY_64 1
-
-/* Solaris allows 64 bit out and global registers in 32 bit mode.
-   sparc_override_options will disable V8+ if not generating V9 code.  */
-#undef TARGET_DEFAULT
-#define TARGET_DEFAULT (MASK_V8PLUS + MASK_APP_REGS + MASK_FPU \
-			+ MASK_LONG_DOUBLE_128)
-
-/* Solaris-specific #pragmas are implemented on top of attributes.  Hook in
-   the bits from config/sol2.c.  */
-#define SUBTARGET_INSERT_ATTRIBUTES solaris_insert_attributes
-#define SUBTARGET_ATTRIBUTE_TABLE SOLARIS_ATTRIBUTE_TABLE
-
-/* Register the Solaris-specific #pragma directives.  */
-#define REGISTER_TARGET_PRAGMAS() solaris_register_pragmas ()
-
-/* Output a simple call for .init/.fini.  */
-#define ASM_OUTPUT_CALL(FILE, FN)				        \
-  do									\
-    {									\
-      fprintf (FILE, "\tcall\t");					\
-      targetm.asm_out.print_operand (FILE, XEXP (DECL_RTL (FN), 0), 0);	\
-      fprintf (FILE, "\n\tnop\n");					\
-    }									\
-  while (0)
-
-/* This is how to output an assembler line that says to advance
-   the location counter to a multiple of 2**LOG bytes using the
-   NOP instruction as padding.  */
-#define ASM_OUTPUT_ALIGN_WITH_NOP(FILE,LOG)   \
-  if ((LOG) != 0)                             \
-    fprintf (FILE, "\t.align %d,0x1000000\n", (1<<(LOG)))
-
-/* Use Solaris ELF section syntax.  */
-#undef TARGET_ASM_NAMED_SECTION
-#define TARGET_ASM_NAMED_SECTION sparc_solaris_elf_asm_named_section
-
-/* Emit COMDAT group signature symbols for Sun as.  */
-#undef TARGET_ASM_CODE_END
-#define TARGET_ASM_CODE_END solaris_code_end
-
-/* Solaris/SPARC as requires doublequoted section names.  While gas
-   supports that, too, we prefer the standard variant.  */
-#ifndef USE_GAS
-#undef SECTION_NAME_FORMAT
-#define SECTION_NAME_FORMAT	"\"%s\""
-#endif
-
-/* Static stack checking is supported by means of probes.  */
-#define STACK_CHECK_STATIC_BUILTIN 1
diff --git a/gcc/config/usegld.h b/gcc/config/usegld.h
new file mode 100644
--- /dev/null
+++ b/gcc/config/usegld.h
@@ -0,0 +1,1 @@ 
+#define USE_GLD 1