Hi,

the following patch changes the GCC configuration for FreeBSD SPARC
(we only support 64-bit v9 there) so that the target CPU type may
be set via -mcpu instead of limiting to the hardcoded equivalent of
-mcpu=ultrasparc and TLS support is enabled if available. Both changes
are also present in the GCC version we ship as system compiler (the
former change actually since 3 years) and additionally have been
regression tested on sparc64-portbld-freebsd9.0.

I'm asking for review and the patch to be applied HEAD and the 4.6
branch once 4.6.0 is released. Gerald (CC'ed) is willing to apply it
for me.

Regards,
Marius

2011-03-22  Marius Strobl <mar...@freebsd.org>

        * config/sparc/freebsd.h (CPP_CPU64_DEFAULT_SPEC): Replace with...
        (FBSD_TARGET_CPU_CPP_BUILTINS): ...this.
        (TARGET_GNU_TLS, TARGET_SUN_TLS): Define.

Index: config/sparc/freebsd.h
===================================================================
--- config/sparc/freebsd.h      (revision 170921)
+++ config/sparc/freebsd.h      (working copy)
@@ -24,11 +24,19 @@ along with GCC; see the file COPYING3.  If not see
   { "fbsd_dynamic_linker", FBSD_DYNAMIC_LINKER }
 
 /* FreeBSD needs the platform name (sparc64) defined.
-   Emacs needs to know if the arch is 64 or 32-bits.  */
+   Emacs etc needs to know if the arch is 64 or 32-bits.
+   This also selects which targets are available via -mcpu.  */
 
-#undef  CPP_CPU64_DEFAULT_SPEC
-#define CPP_CPU64_DEFAULT_SPEC \
-  "-D__sparc64__ -D__sparc_v9__ -D__sparcv9 -D__arch64__"
+#undef  FBSD_TARGET_CPU_CPP_BUILTINS
+#define FBSD_TARGET_CPU_CPP_BUILTINS()         \
+  do                                           \
+    {                                          \
+      builtin_define ("__sparc64__");          \
+      builtin_define ("__sparc__");            \
+      builtin_define ("__sparc_v9__");         \
+      builtin_define ("__sparcv9");            \
+    }                                          \
+  while (0)
 
 #undef ASM_SPEC
 #define ASM_SPEC "%{fpic|fPIC|fpie|fPIE:-K PIC} %(asm_cpu)"
@@ -152,6 +160,13 @@ along with GCC; see the file COPYING3.  If not see
 
 /* #define DWARF_OFFSET_SIZE PTR_SIZE */
 
+#ifdef HAVE_AS_TLS
+#undef TARGET_SUN_TLS
+#undef TARGET_GNU_TLS
+#define TARGET_SUN_TLS 0
+#define TARGET_GNU_TLS 1
+#endif
+
 #undef ENDFILE_SPEC
 #define ENDFILE_SPEC                                           \
   "%{ffast-math|funsafe-math-optimizations:crtfastmath.o%s} "  \

Reply via email to