PR28264, ld.bfd crash on linking efivar with LTO
authorAlan Modra <amodra@gmail.com>
Thu, 26 Aug 2021 02:49:35 +0000 (12:19 +0930)
committerAlan Modra <amodra@gmail.com>
Sat, 28 Aug 2021 00:49:09 +0000 (10:19 +0930)
PR 28264
PR 26978
* linker.c (_bfd_generic_link_add_one_symbol <MIND>): Check
that string is non-NULL.

bfd/linker.c

index 755ff19923bca9a2e6353363d65f6fe7fb895e6b..f8257ea11b44be2d35ab57e9dfed547c4404ff3c 100644 (file)
@@ -1682,7 +1682,7 @@ _bfd_generic_link_add_one_symbol (struct bfd_link_info *info,
              cycle = true;
              break;
            }
-         if (strcmp (h->u.i.link->root.string, string) == 0)
+         if (string != NULL && strcmp (h->u.i.link->root.string, string) == 0)
            break;
          /* Fall through.  */
        case MDEF: