This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
[RFA:] bfd/linker.c: Handle a symbol entered through a plugin for the generic linker
- From: Hans-Peter Nilsson <hp at bitrange dot com>
- To: binutils at sourceware dot org
- Cc: Jan Hubicka <jh at suse dot cz>
- Date: Sat, 20 Oct 2012 21:38:08 -0400 (EDT)
- Subject: [RFA:] bfd/linker.c: Handle a symbol entered through a plugin for the generic linker
This fixes about 400 LTO regressions in the gcc test-suite for
mmix-knuth-mmixware with -fno-fat-lto-objects, uncovered by a recent
LTO change in gcc, specifically r192159.
There are lots of abfd->flags & BFD_PLUGIN tests along the pure-ELF
code-path, where this case is handled in elf_link_output_extsym,
testing for BFD_PLUGIN and setting strip = TRUE to not output the symbol.
At least this case is missing for the generic linker, which is used for
mmix-knuth-mmixware (linking ELF input, producing mmo output) but I
saw no further asserts or internal errors. Not much use testing this
change besides that it compiles, as it just changes previous aborting
behaviour:
x/mmix/bin/ld: BFD (GNU Binutils) 2.23.51.20120929 internal error,
aborting at x/src/bfd/linker.c line 2363 in _bfd_generic_link_output_symbols
x/mmix/bin/ld: Please report this bug.
And yes, that thing should be something calling BFD_ASSERT rather than
an abort (which is #defined to _bfd_abort, behaving as above), but
that'd be material for a follow-up rather than in this patch.
Sorry, no other test-case.
Ok for trunk?
bfd:
* linker.c (_bfd_generic_link_output_symbols): Handle a
no-longer-global symbol entered through a plugin.
Index: bfd/linker.c
===================================================================
RCS file: /cvs/src/src/bfd/linker.c,v
retrieving revision 1.95
diff -p -u -r1.95 linker.c
--- bfd/linker.c 5 May 2012 04:51:15 -0000 1.95
+++ bfd/linker.c 20 Oct 2012 18:44:27 -0000
@@ -2359,6 +2359,12 @@ _bfd_generic_link_output_symbols (bfd *o
else
output = FALSE;
}
+ else if (sym->flags == 0
+ && (sym->section->owner->flags & BFD_PLUGIN) != 0)
+ /* LTO doesn't set symbol information. We get here with the
+ generic linker for a symbol that was "common" but no longer
+ needs to be global. */
+ output = FALSE;
else
abort ();
brgds, H-P