From: Nick Clifton Date: Thu, 30 Sep 2021 11:56:19 +0000 (+0100) Subject: make objcopy fail if it is asked to redefine symbols in an object file containing... X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=7325ba796b4432b73388d0cdbd5b0e8c8dee8855;p=binutils-gdb.git make objcopy fail if it is asked to redefine symbols in an object file containing LTO information. * objcopy.c (filter_symbols): Fail if attempting to dredefine symbols in an LTO object file. --- diff --git a/binutils/ChangeLog b/binutils/ChangeLog index 5957d6f8677..0d5e4a0f2a0 100644 --- a/binutils/ChangeLog +++ b/binutils/ChangeLog @@ -1,3 +1,8 @@ +2021-09-30 Nick Clifton + + * objcopy.c (filter_symbols): Fail if attempting to dredefine + symbols in an LTO object file. + 2021-09-27 Nick Alcock * configure: Regenerate. diff --git a/binutils/objcopy.c b/binutils/objcopy.c index fd7557fe433..75fd89d338b 100644 --- a/binutils/objcopy.c +++ b/binutils/objcopy.c @@ -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)