From 7325ba796b4432b73388d0cdbd5b0e8c8dee8855 Mon Sep 17 00:00:00 2001 From: Nick Clifton Date: Thu, 30 Sep 2021 12:56:19 +0100 Subject: 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. --- binutils/objcopy.c | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'binutils/objcopy.c') diff --git a/binutils/objcopy.c b/binutils/objcopy.c index fd7557f..75fd89d 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) -- cgit v1.1