aboutsummaryrefslogtreecommitdiff
path: root/binutils/objcopy.c
diff options
context:
space:
mode:
authorNick Clifton <nickc@redhat.com>2021-09-30 12:56:19 +0100
committerNick Clifton <nickc@redhat.com>2021-09-30 12:56:19 +0100
commit7325ba796b4432b73388d0cdbd5b0e8c8dee8855 (patch)
treed984f709027c163ac8a6113181925be613d9fa7f /binutils/objcopy.c
parent6010fb0c49e7dd9f183375fb4f343acc2999e127 (diff)
downloadgdb-7325ba796b4432b73388d0cdbd5b0e8c8dee8855.zip
gdb-7325ba796b4432b73388d0cdbd5b0e8c8dee8855.tar.gz
gdb-7325ba796b4432b73388d0cdbd5b0e8c8dee8855.tar.bz2
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.
Diffstat (limited to 'binutils/objcopy.c')
-rw-r--r--binutils/objcopy.c7
1 files changed, 7 insertions, 0 deletions
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)