]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
PowerPC64 TLS optimization fix
authorAlan Modra <amodra@gmail.com>
Wed, 22 Jan 2020 02:32:11 +0000 (13:02 +1030)
committerAlan Modra <amodra@gmail.com>
Wed, 29 Jan 2020 00:41:36 +0000 (11:11 +1030)
When linking with --no-tls-optimize the linker doesn't generate a call
or long branch stub to __tls_get_addr in some circumstances, giving:

relocation truncated to fit: R_PPC64_REL24 against symbol `__tls_get_addr'

* elf64-ppc.c (ppc64_elf_size_stubs): Correct condition under
which __tls_get_addr calls will be eliminated.

(cherry picked from commit abc489c64a3137f3751797e8ce60d53a2c432e1d)

bfd/ChangeLog
bfd/elf64-ppc.c

index 0ce42c32b2e45d8df1956f6c401b1d722ff9cf49..37bc1c60f3ca81a25c0b67b65fde2e16b5c4280b 100644 (file)
@@ -1,3 +1,10 @@
+2020-01-29  Alan Modra  <amodra@gmail.com>
+
+       Apply from master
+       2020-01-22  Alan Modra  <amodra@gmail.com>
+       * elf64-ppc.c (ppc64_elf_size_stubs): Correct condition under
+       which __tls_get_addr calls will be eliminated.
+
 2020-01-23  Nick Clifton  <nickc@redhat.com>
 
        * po/fr.po: Updated French translation.
index 8319a21940880020a543c7d40439b24418fd6b85..73ea2865fd5521f1e99c34be2bd473ae3c22d4a2 100644 (file)
@@ -13080,7 +13080,8 @@ ppc64_elf_size_stubs (struct bfd_link_info *info)
                      if (!get_tls_mask (&tls_mask, NULL, NULL, &local_syms,
                                         irela - 1, input_bfd))
                        goto error_ret_free_internal;
-                     if ((*tls_mask & TLS_TLS) != 0)
+                     if ((*tls_mask & TLS_TLS) != 0
+                         && (*tls_mask & (TLS_GD | TLS_LD)) == 0)
                        continue;
                    }