* Commit: objcopy: Fail if attempting to redefine symbols in LTO files
@ 2021-09-30 11:56 Nick Clifton
0 siblings, 0 replies; only message in thread
From: Nick Clifton @ 2021-09-30 11:56 UTC (permalink / raw)
To: binutils
Hi Guys,
I am applying the patch below to add a fatal error message to objcopy
if the user attempts to use --redefine-sym (or --redefine-syms) on an
object file containing LTO information. Since LTO uses its own symbol
tables, plus modifying symbols in the ordinary symbol table, symbol
redefinition is not going to work. (Plus I did not fancy trying to
implement the code to make it work. Especially since the LTO symbol
table format is not fixed or even well defined).
Cheers
Nick
binutils/ChangeLog
2021-09-30 Nick Clifton <nickc@redhat.com>
* objcopy.c (filter_symbols): Fail if attempting to dredefine
symbols in an LTO object file.
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)
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2021-09-30 11:56 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-30 11:56 Commit: objcopy: Fail if attempting to redefine symbols in LTO files Nick Clifton
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).