make objcopy fail if it is asked to redefine symbols in an object file containing...
authorNick Clifton <nickc@redhat.com>
Thu, 30 Sep 2021 11:56:19 +0000 (12:56 +0100)
committerNick Clifton <nickc@redhat.com>
Thu, 30 Sep 2021 11:56:19 +0000 (12:56 +0100)
* objcopy.c (filter_symbols): Fail if attempting to dredefine
symbols in an LTO object file.

binutils/ChangeLog
binutils/objcopy.c

index 5957d6f8677df935ef437e6012f2f760b62fb784..0d5e4a0f2a0360c6d2149e54fce6b99664a0bda3 100644 (file)
@@ -1,3 +1,8 @@
+2021-09-30  Nick Clifton  <nickc@redhat.com>
+
+       * objcopy.c (filter_symbols): Fail if attempting to dredefine
+       symbols in an LTO object file.
+
 2021-09-27  Nick Alcock  <nick.alcock@oracle.com>
 
        * configure: Regenerate.
index fd7557fe4335b9b876fbdc59d884ade9437e7796..75fd89d338bb96aab1d0d91378c74ba3592246f7 100644 (file)
@@ -1542,6 +1542,13 @@ filter_symbols (bfd *abfd, bfd *obfd, asymbol **osyms,
        {
          char *new_name;
 
+         if (name[0] == '_'
+             && name[1] == '_'
+             && strcmp (name + (name[2] == '_'), "__gnu_lto_slim") == 0)
+           {
+             fatal (_("redefining symbols does not work on LTO-compiled object files"));
+           }
+         
          new_name = (char *) lookup_sym_redefinition (name);
          if (new_name == name
              && (flags & BSF_SECTION_SYM) != 0)