https://gcc.gnu.org/g:086ee8d08669fe597e6c63a4e5489d2df7698ec8

commit r15-5501-g086ee8d08669fe597e6c63a4e5489d2df7698ec8
Author: Uros Bizjak <ubiz...@gmail.com>
Date:   Wed Nov 20 12:57:25 2024 +0100

    i386: Remove workaround for Solaris ld 64-bit TLS IE limitation
    
    As detailed in PR target/43309, the Solaris linker initially took the
    64-bit x86 TLS IE code sequence literally, assuming that the spec only
    allowed %rax as target register.
    
    A workaround has been in place for more than a decade, but is no longer
    necessary.  The bug had already been fixed for Solaris 11.1, while trunk
    requires Solaris 11.4.
    
    Uros pointed this out and suggested the attached patch.
    
    Bootstrapped without regressions on i386-pc-solaris2.11.
    
    2024-10-15  Uros Bizjak  <ubiz...@gmail.com>
    
            gcc:
            * config/i386/i386.cc (legitimize_tls_address)
            <TLS_MODEL_INITIAL_EXEC>: Remove 64-bit Solaris ld workaround.
            * config/i386/i386.md (UNSPEC_TLS_IE_SUN): Remove.
            (tls_initial_exec_64_sun): Remove.

Diff:
---
 gcc/config/i386/i386.cc | 11 -----------
 gcc/config/i386/i386.md | 17 -----------------
 2 files changed, 28 deletions(-)

diff --git a/gcc/config/i386/i386.cc b/gcc/config/i386/i386.cc
index 9d3d8abf7803..c7e70c21999e 100644
--- a/gcc/config/i386/i386.cc
+++ b/gcc/config/i386/i386.cc
@@ -12320,17 +12320,6 @@ legitimize_tls_address (rtx x, enum tls_model model, 
bool for_mov)
     case TLS_MODEL_INITIAL_EXEC:
       if (TARGET_64BIT)
        {
-         if (TARGET_SUN_TLS && !TARGET_X32)
-           {
-             /* The Sun linker took the AMD64 TLS spec literally
-                and can only handle %rax as destination of the
-                initial executable code sequence.  */
-
-             dest = gen_reg_rtx (DImode);
-             emit_insn (gen_tls_initial_exec_64_sun (dest, x));
-             return dest;
-           }
-
          /* Generate DImode references to avoid %fs:(%reg32)
             problems and linker IE->LE relaxation bug.  */
          tp_mode = DImode;
diff --git a/gcc/config/i386/i386.md b/gcc/config/i386/i386.md
index b2209492fa0e..1c1bf659fc25 100644
--- a/gcc/config/i386/i386.md
+++ b/gcc/config/i386/i386.md
@@ -93,7 +93,6 @@
   UNSPEC_TLS_GD
   UNSPEC_TLS_LD_BASE
   UNSPEC_TLSDESC
-  UNSPEC_TLS_IE_SUN
 
   ;; Other random patterns
   UNSPEC_SCAS
@@ -22876,22 +22875,6 @@
   set_mem_addr_space (operands[2], as);
 })
 
-;; The Sun linker took the AMD64 TLS spec literally and can only handle
-;; %rax as destination of the initial executable code sequence.
-(define_insn "tls_initial_exec_64_sun"
-  [(set (match_operand:DI 0 "register_operand" "=a")
-       (unspec:DI
-        [(match_operand 1 "tls_symbolic_operand")]
-        UNSPEC_TLS_IE_SUN))
-   (clobber (reg:CC FLAGS_REG))]
-  "TARGET_64BIT && TARGET_SUN_TLS"
-{
-  output_asm_insn
-    ("mov{q}\t{%%fs:0, %0|%0, QWORD PTR fs:0}", operands);
-  return "add{q}\t{%a1@gottpoff(%%rip), %0|%0, %a1@gottpoff[rip]}";
-}
-  [(set_attr "type" "multi")])
-
 ;; GNU2 TLS patterns can be split.
 
 (define_expand "tls_dynamic_gnu2_32"

Reply via email to