]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
backport: re PR target/43309 (amd64 TLS IE code sequence on Solaris 2/x86 violates...
authorRainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
Fri, 7 Jan 2011 13:02:29 +0000 (13:02 +0000)
committerRainer Orth <ro@gcc.gnu.org>
Fri, 7 Jan 2011 13:02:29 +0000 (13:02 +0000)
Backport from mainline:
2011-01-06  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>

PR target/43309
* config/i386/i386.c (legitimize_tls_address)
<TLS_MODEL_INITIAL_EXEC>: Handle TARGET_64BIT && TARGET_SUN_TLS.
* config/i386/i386.md (UNSPEC_TLS_IE_SUN): Declare.
(tls_initial_exec_64_sun): New pattern.

From-SVN: r168567

gcc/ChangeLog
gcc/config/i386/i386.c
gcc/config/i386/i386.md

index f03cfee9a088682855ebfdd4418ab2ebef09bd28..e531cac02d15da3532450de8df030dc3f8c53b2f 100644 (file)
@@ -1,3 +1,14 @@
+2011-01-07  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>
+
+       Backport from mainline:
+       2011-01-06  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>
+
+       PR target/43309
+       * config/i386/i386.c (legitimize_tls_address)
+       <TLS_MODEL_INITIAL_EXEC>: Handle TARGET_64BIT && TARGET_SUN_TLS.
+       * config/i386/i386.md (UNSPEC_TLS_IE_SUN): Declare.
+       (tls_initial_exec_64_sun): New pattern.
+
 2011-01-03  Eric Botcazou  <ebotcazou@adacore.com>
 
        Backport from mainline
index 1eb11607be81312beeb568908a21bdf1ddc45250..e60a4c3bf83bb1c30b3f5f2eb767f839d8c6be33 100644 (file)
@@ -10438,6 +10438,17 @@ legitimize_tls_address (rtx x, enum tls_model model, int for_mov)
     case TLS_MODEL_INITIAL_EXEC:
       if (TARGET_64BIT)
        {
+         if (TARGET_SUN_TLS)
+           {
+             /* 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 (Pmode);
+             emit_insn (gen_tls_initial_exec_64_sun (dest, x));
+             return dest;
+           }
+
          pic = NULL;
          type = UNSPEC_GOTNTPOFF;
        }
index 6f3d6a525fec71311d3e0061db717f9ea294c203..6642b6239b82111f510faff795427434df18e6e8 100644 (file)
@@ -92,6 +92,7 @@
    (UNSPEC_TLS_GD              21)
    (UNSPEC_TLS_LD_BASE         22)
    (UNSPEC_TLSDESC             23)
+   (UNSPEC_TLS_IE_SUN          24)
 
    ; Other random patterns
    (UNSPEC_SCAS                        30)
    (set_attr "memory" "load")
    (set_attr "imm_disp" "false")])
 
+;; 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:DI 1 "tls_symbolic_operand" "")]
+        UNSPEC_TLS_IE_SUN))
+   (clobber (reg:CC FLAGS_REG))]
+  "TARGET_64BIT && TARGET_SUN_TLS"
+  "mov{q}\t{%%fs:0, %0|%0, QWORD PTR fs:0}\n\tadd{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"