]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
sparc: Switch TARGET_SUN_TLS default
authorRainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
Thu, 15 Jan 2026 08:45:06 +0000 (09:45 +0100)
committerRainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
Thu, 15 Jan 2026 08:45:06 +0000 (09:45 +0100)
sparc/sparc.h currently defaults to TARGET_SUN_TLS.  All other SPARC
targets and Solaris with GNU as have to override this, although this is
only needed on Solaris/SPARC with the native assembler.

To simplify the code, this patch switches the default to TARGET_SUN_TLS
set to 0, removing the need for all the overrides.

TARGET_GNU_TLS is only used in two places and can be replaced by
!TARGET_SUN_TLS, too.

Bootstrapped without regressions on sparc-sun-solaris2.11 (as and gas)
and sparc64-unknown-linux-gnu.

2026-01-13  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>

gcc:
* config/sparc/sparc.h (TARGET_TLS): Define as HAVE_AS_TLS.
Update comment.
(TARGET_SUN_TLS): Define as 0.
(TARGET_GNU_TLS): Remove.
* config/sparc/freebsd.h (TARGET_SUN_TLS): Remove.
(TARGET_GNU_TLS): Remove.
* config/sparc/linux.h: Likewise.
* config/sparc/linux64.h: Likewise.
* config/sparc/sol2.h (TARGET_SUN_TLS): Redefine as 1.
Guard with HAVE_AS_TLS && !HAVE_GNU_AS.
(TARGET_GNU_TLS): Remove.
* config/sparc/sparc.cc (TARGET_ASM_OUTPUT_DWARF_DTPREL): Use
!TARGET_SUN_TLS in guard.
with !TARGET_SUN_TLS only.
* config/sparc/sparc.md ("tls_delay_slot"): Guard with
!TARGET_SUN_TLS.

gcc/config/sparc/freebsd.h
gcc/config/sparc/linux.h
gcc/config/sparc/linux64.h
gcc/config/sparc/sol2.h
gcc/config/sparc/sparc.cc
gcc/config/sparc/sparc.h
gcc/config/sparc/sparc.md

index 209f6618d26fb59e8bb7033dfb9b6077dbf0abc3..4820150d1e4227378643e0ee331d86cb07c4e234 100644 (file)
@@ -118,13 +118,6 @@ 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                                           \
   "%{Ofast|ffast-math|funsafe-math-optimizations:%{!shared:crtfastmath.o%s}} " \
index 4d0c8c1a967b0c8e2c0a8252e51049086f624210..750ed63ff56f62c12ef8b0ef82d8832ed4680be7 100644 (file)
@@ -120,13 +120,6 @@ do {                                                                       \
 #undef DITF_CONVERSION_LIBFUNCS
 #define DITF_CONVERSION_LIBFUNCS 1
 \f
-#ifdef HAVE_AS_TLS
-#undef TARGET_SUN_TLS
-#undef TARGET_GNU_TLS
-#define TARGET_SUN_TLS 0
-#define TARGET_GNU_TLS 1
-#endif
-\f
 /* We use GNU ld so undefine this so that attribute((init_priority)) works.  */
 #undef CTORS_SECTION_ASM_OP
 #undef DTORS_SECTION_ASM_OP
index 923f2d2944eecd4a9da4a8bde75c5e1e47508415..9ece60e65ec2aa43d724f372cb5e4950835bff22 100644 (file)
@@ -264,13 +264,6 @@ do {                                                                       \
 #undef DITF_CONVERSION_LIBFUNCS
 #define DITF_CONVERSION_LIBFUNCS 1
 \f
-#ifdef HAVE_AS_TLS
-#undef TARGET_SUN_TLS
-#undef TARGET_GNU_TLS
-#define TARGET_SUN_TLS 0
-#define TARGET_GNU_TLS 1
-#endif
-\f
 /* We use GNU ld so undefine this so that attribute((init_priority)) works.  */
 #undef CTORS_SECTION_ASM_OP
 #undef DTORS_SECTION_ASM_OP
index 50eececa3fc44882ceb47d32d42bd69ed74aaf57..c04c8f069d02cf96c9ef734736a1b55010a9dcb5 100644 (file)
@@ -326,12 +326,9 @@ extern const char *host_detect_local_cpu (int argc, const char **argv);
 /* Register the Solaris-specific #pragma directives.  */
 #define REGISTER_TARGET_PRAGMAS() solaris_register_pragmas ()
 
-#if HAVE_GNU_AS && 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
+#if HAVE_AS_TLS && !HAVE_GNU_AS
+#undef TARGET_SUN_TLS
+#define TARGET_SUN_TLS 1
 #endif
 
 #undef  LOCAL_LABEL_PREFIX
index 4ed1c6f96955301e4fb56346cb5083df28f1d128..7bed27d3569930d82401cb68a1aed331a55c47d4 100644 (file)
@@ -877,7 +877,7 @@ char sparc_hard_reg_printed[8];
 #define TARGET_STACK_PROTECT_GUARD hook_tree_void_null
 #endif
 
-#if TARGET_GNU_TLS && defined(HAVE_AS_SPARC_UA_PCREL)
+#if !TARGET_SUN_TLS && defined(HAVE_AS_SPARC_UA_PCREL)
 #undef TARGET_ASM_OUTPUT_DWARF_DTPREL
 #define TARGET_ASM_OUTPUT_DWARF_DTPREL sparc_output_dwarf_dtprel
 #endif
index dcf91553e5d8a391a88f1569953ceb9a6dcc3051..32d6a8c3d8615210c8eef0ee3369f4b31b37dcaa 100644 (file)
@@ -1640,16 +1640,10 @@ extern int sparc_indent_opcode;
       }                                        \
   } while (0)
 
-/* TLS support defaulting to original Sun flavor.  GNU extensions
-   must be activated in separate configuration files.  */
-#ifdef HAVE_AS_TLS
-#define TARGET_TLS 1
-#else
-#define TARGET_TLS 0
-#endif
-
-#define TARGET_SUN_TLS TARGET_TLS
-#define TARGET_GNU_TLS 0
+/* TLS support defaults to GNU extensions.  The original Sun flavor must be
+   activated in separate configuration files.  */
+#define TARGET_TLS HAVE_AS_TLS
+#define TARGET_SUN_TLS 0
 
 #ifdef HAVE_AS_FMAF_HPC_VIS3
 #define AS_NIAGARA3_FLAG "d"
index b89ba1a0abf8285a494a7efc0b2b610df1b60cb1..f4b9d2f4765945bb0751a442e9f26eb33d6b5e43 100644 (file)
 
 ;; Attributes for branch scheduling
 (define_attr "tls_delay_slot" "false,true"
-  (symbol_ref "((TARGET_GNU_TLS && HAVE_GNU_LD) != 0
+  (symbol_ref "((!TARGET_SUN_TLS && HAVE_GNU_LD) != 0
                ? TLS_DELAY_SLOT_TRUE : TLS_DELAY_SLOT_FALSE)"))
 
 (define_attr "in_sibcall_delay" "false,true"