Segfault in ld building SPEC CPU2017 527.cam4_r with -flto
authorAlan Modra <amodra@gmail.com>
Wed, 28 Aug 2019 14:50:46 +0000 (00:20 +0930)
committerAlan Modra <amodra@gmail.com>
Wed, 28 Aug 2019 15:03:49 +0000 (00:33 +0930)
Caused by the PR24406 fix.  unwrap_hash_lookup shouldn't be called
with link_info.wrap_hash NULL.

PR ld/24406
* plugin.c (get_symbols): Test link_info.wrap_hash before calling
unwrap_hash_lookup.

ld/ChangeLog
ld/plugin.c

index ed646acffaefb8aa8a48c733c320ddc2e4a7a698..b654eb9d3638fb4bd5371b92309c2ce4291825ab 100644 (file)
@@ -1,3 +1,9 @@
+2019-08-29  Alan Modra  <amodra@gmail.com>
+
+       PR ld/24406
+       * plugin.c (get_symbols): Test link_info.wrap_hash before calling
+       unwrap_hash_lookup.
+
 2019-08-22  Tamar Christina  <tamar.christina@arm.com>
 
        PR ld/24601
index 0344da2df9e10a968f847439a0a10679e369a006..47e5cea82ea9365899647ff07c9a5b7e94da51e1 100644 (file)
@@ -749,7 +749,7 @@ get_symbols (const void *handle, int nsyms, struct ld_plugin_symbol *syms,
       if (syms[n].def != LDPK_UNDEF && syms[n].def != LDPK_WEAKUNDEF)
        {
          blhe = h;
-         if (blhe)
+         if (blhe && link_info.wrap_hash != NULL)
            {
              /* Check if a symbol is a wrapper symbol.  */
              struct bfd_link_hash_entry *unwrap