]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
sparc: Remove TARGET_SUN_TLS
authorRainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
Thu, 15 Jan 2026 12:03:59 +0000 (13:03 +0100)
committerRainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
Thu, 15 Jan 2026 12:03:59 +0000 (13:03 +0100)
All remaining uses of TARGET_SUN_TLS refer to either

* a feature missing in Solaris as:

  Lack of support for R_SPARC_TLS_DTPOFF{32,64}: while Solaris ld
  supports those just fine, I know of no Solaris as syntax for them.

* workarounds for bugs in Solaris as in sparc_tls_got,
  sparc_legitimize_tls_address, and the tls_delay_slot attribute

Therefor this patch replaces all uses of TARGET_SUN_TLS with
!HAVE_GNU_AS.

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

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

gcc:
* config/sparc/sparc.h (TARGET_SUN_TLS): Remove.
* config/sparc/sol2.h (TARGET_SUN_TLS): Likewise.

* config/sparc/sparc.cc (TARGET_ASM_OUTPUT_DWARF_DTPREL): Guard
with HAVE_GNU_AS.
(sparc_tls_got): Guard with !HAVE_GNU_AS.
(sparc_legitimize_tls_address): Likewise.
* config/sparc/sparc.md ("tls_delay_slot"): Likewise.
("@tie_add<P:mode>"): Likewise.

gcc/config/sparc/sol2.h
gcc/config/sparc/sparc.cc
gcc/config/sparc/sparc.h
gcc/config/sparc/sparc.md

index b985fa8755ae9ac994e4f38ab6e7be6be7c52d1f..fde5e388fbebb0625bd5870554f4246f62cf0518 100644 (file)
@@ -315,11 +315,6 @@ 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_AS_TLS && !HAVE_GNU_AS
-#undef TARGET_SUN_TLS
-#define TARGET_SUN_TLS 1
-#endif
-
 #undef  LOCAL_LABEL_PREFIX
 #define LOCAL_LABEL_PREFIX  "."
 
index f7c355cd4a87dde391ea9b2aad995a5a46b2a65f..18e76afb57de3dd2cec53225d4c2abde68e0381d 100644 (file)
@@ -877,7 +877,7 @@ char sparc_hard_reg_printed[8];
 #define TARGET_STACK_PROTECT_GUARD hook_tree_void_null
 #endif
 
-#if !TARGET_SUN_TLS
+#if HAVE_GNU_AS
 #undef TARGET_ASM_OUTPUT_DWARF_DTPREL
 #define TARGET_ASM_OUTPUT_DWARF_DTPREL sparc_output_dwarf_dtprel
 #endif
@@ -4701,7 +4701,7 @@ sparc_tls_got (void)
 
   /* In non-PIC mode, Sun as (unlike GNU as) emits PC-relative relocations for
      the GOT symbol with the 32-bit ABI, so we reload the GOT register.  */
-  if (TARGET_SUN_TLS && TARGET_ARCH32)
+  if (!HAVE_GNU_AS && TARGET_ARCH32)
     {
       load_got_register ();
       return got_register_rtx;
@@ -4805,7 +4805,7 @@ sparc_legitimize_tls_address (rtx addr)
          emit_insn (gen_tie_ld32 (temp3, got, temp2, addr));
        else
          emit_insn (gen_tie_ld64 (temp3, got, temp2, addr));
-        if (TARGET_SUN_TLS)
+       if (!HAVE_GNU_AS)
          {
            ret = gen_reg_rtx (Pmode);
            emit_insn (gen_tie_add (Pmode, ret, gen_rtx_REG (Pmode, 7),
index c5a45b05869247c91acc05d696846c9e91b57e39..87a3f9da89bff059ad0c7eec41a94f70e6302db4 100644 (file)
@@ -1623,7 +1623,6 @@ extern int sparc_indent_opcode;
 /* 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 f4b9d2f4765945bb0751a442e9f26eb33d6b5e43..46f6e70405bec1c794042874d7fd2f1b7d8ea20a 100644 (file)
 
 ;; Attributes for branch scheduling
 (define_attr "tls_delay_slot" "false,true"
-  (symbol_ref "((!TARGET_SUN_TLS && HAVE_GNU_LD) != 0
+  (symbol_ref "((HAVE_GNU_AS && HAVE_GNU_LD) != 0
                ? TLS_DELAY_SLOT_TRUE : TLS_DELAY_SLOT_FALSE)"))
 
 (define_attr "in_sibcall_delay" "false,true"
                (unspec:P [(match_operand:P 2 "register_operand" "r")
                           (match_operand 3 "tie_symbolic_operand" "")]
                          UNSPEC_TLSIE)))]
-  "TARGET_SUN_TLS"
+  "!HAVE_GNU_AS"
   "add\\t%1, %2, %0, %%tie_add(%a3)")
 
 (define_insn "@tle_hix22<P:mode>"