]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
Fix problematic TLS sequences for the Solaris linker
authorEric Botcazou <ebotcazou@gcc.gnu.org>
Fri, 14 Feb 2020 18:21:02 +0000 (19:21 +0100)
committerEric Botcazou <ebotcazou@gcc.gnu.org>
Fri, 14 Feb 2020 18:26:46 +0000 (19:26 +0100)
This is an old thinko pertaining to the interaction between TLS
sequences and delay slot filling: the compiler knows that it cannot
put instructions with TLS relocations into delay slots with the
original Sun TLS model, but it tests TARGET_SUN_TLS in this context,
which depends only on the assembler.  So if the compiler is configured
with the GNU assembler and the Solaris linker, then TARGET_GNU_TLS is
set instead and the limitation is not enforced.

PR target/93704
* config/sparc/sparc.c (eligible_for_call_delay): Test HAVE_GNU_LD
in conjunction with TARGET_GNU_TLS in early return.

gcc/ChangeLog
gcc/config/sparc/sparc.c

index cfcec41c7224efe0f0bcf316f8e3abdff1a23edd..1e97432f0d58c123e452c0a33495d020b61845b1 100644 (file)
@@ -1,3 +1,9 @@
+2020-02-14  Eric Botcazou  <ebotcazou@adacore.com>
+
+       PR target/93704
+       * config/sparc/sparc.c (eligible_for_call_delay): Test HAVE_GNU_LD in
+       conjunction with TARGET_GNU_TLS in early return.
+
 2020-02-14  Alexander Monakov  <amonakov@ispras.ru>
 
        Backport from mainline
index ca783a68e2df19d84235546172b90ecc54b62d37..a993aab7639246cea1a69746bd9a753fbf763df3 100644 (file)
@@ -3972,11 +3972,8 @@ eligible_for_call_delay (rtx_insn *trial)
   if (get_attr_in_branch_delay (trial) == IN_BRANCH_DELAY_FALSE)
     return 0;
 
-  /* Binutils allows
-       call __tls_get_addr, %tgd_call (foo)
-        add %l7, %o0, %o0, %tgd_add (foo)
-     while Sun as/ld does not.  */
-  if (TARGET_GNU_TLS || !TARGET_TLS)
+  /* The only problematic cases are TLS sequences with Sun as/ld.  */
+  if ((TARGET_GNU_TLS && HAVE_GNU_LD) || !TARGET_TLS)
     return 1;
 
   pat = PATTERN (trial);