]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
PR ld/22832 on SPARC.
authorEric Botcazou <ebotcazou@gcc.gnu.org>
Thu, 15 Feb 2018 14:55:11 +0000 (15:55 +0100)
committerEric Botcazou <ebotcazou@gcc.gnu.org>
Thu, 15 Feb 2018 15:02:46 +0000 (16:02 +0100)
The fix for PR ld/22727 on SPARC passed TRUE as the 'create' argument
in the call to bfd_link_hash_lookup.  It turns out this was a bad idea
because, if the symbol is created at this point, the link will abort
later in elf_link_output_extsym.  This changes the TRUE into a FALSE
and puts an assertion on the result of the call, making it easier to
debug the issue; that's exactly in keeping with what Gold does.

bfd/
* elfxx-sparc.c (_bfd_sparc_elf_check_relocs) <R_SPARC_TLS_GD_CALL>:
Pass FALSE instead of TRUE as 'create' argument to bfd_link_hash_lookup
and assert that the result of the call is not NULL.

bfd/ChangeLog
bfd/elfxx-sparc.c

index bc4b38817fcaf0340c28cb94408bd21ab0ffedb5..ecd27e515f39059eec46f50b91603459536d92aa 100644 (file)
@@ -1,3 +1,10 @@
+2018-02-15  Eric Botcazou  <ebotcazou@adacore.com>
+
+       PR ld/22832
+       * elfxx-sparc.c (_bfd_sparc_elf_check_relocs) <R_SPARC_TLS_GD_CALL>:
+       Pass FALSE instead of TRUE as 'create' argument to bfd_link_hash_lookup
+       and assert that the result of the call is not NULL.
+
 2018-02-09  Eric Botcazou  <ebotcazou@adacore.com>
 
        * elfxx-sparc.c (UNDEFINED_WEAK_RESOLVED_TO_ZERO): Reorder conditions.
index eff17a6801ed4e5d2c9b4acb3367da50f12151c0..bf4d4dc25c863f2f67348a9ef86def7d31f17e4a 100644 (file)
@@ -1630,8 +1630,9 @@ _bfd_sparc_elf_check_relocs (bfd *abfd, struct bfd_link_info *info,
              /* These are basically R_SPARC_TLS_WPLT30 relocs against
                 __tls_get_addr.  */
              h = (struct elf_link_hash_entry *)
-                 bfd_link_hash_lookup (info->hash, "__tls_get_addr", TRUE,
+                 bfd_link_hash_lookup (info->hash, "__tls_get_addr", FALSE,
                                        FALSE, TRUE);
+             BFD_ASSERT (h != NULL);
            }
          else
            break;