This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
PR15270, excess dynamic symbols with lto
- From: Alan Modra <amodra at gmail dot com>
- To: binutils at sourceware dot org
- Date: Sat, 23 Mar 2013 10:02:04 +1030
- Subject: PR15270, excess dynamic symbols with lto
When ld adds symbols from an IR object, we ensure they aren't made
dynamic, but when later adding symbols from a shared library,
an undefined symbol in an IR object is enough to make a dynamic symbol
when finding a definition in a shared library. The same goes for
definitions in an IR object and references (or even definitions) in a
shared library. We could check the old bfd before making a symbol
dynamic, but I think fiddling with flags will work too. Tested with
gcc bootstrap and regression test on both x86_64 and powerpc.
PR ld/15270
* elflink.c (elf_link_add_object_symbols): Don't set def_regular
or ref_regular for BFD_PLUGIN owned syms, or have them affect
def_dynamic/ref_dynamic.
(_bfd_elf_fix_symbol_flags): Don't set def_regular for BFD_PLUGIN
owned syms.
Index: bfd/elflink.c
===================================================================
RCS file: /cvs/src/src/bfd/elflink.c,v
retrieving revision 1.474
diff -u -p -r1.474 elflink.c
--- bfd/elflink.c 20 Mar 2013 03:44:56 -0000 1.474
+++ bfd/elflink.c 21 Mar 2013 06:02:01 -0000
@@ -2491,7 +2491,7 @@ _bfd_elf_fix_symbol_flags (struct elf_li
&& !h->def_regular
&& h->ref_regular
&& !h->def_dynamic
- && (h->root.u.def.section->owner->flags & DYNAMIC) == 0)
+ && (h->root.u.def.section->owner->flags & (DYNAMIC | BFD_PLUGIN)) == 0)
h->def_regular = 1;
/* If -Bsymbolic was used (which means to bind references to global
@@ -4361,7 +4361,12 @@ error_free_dyn:
is one which is referenced or defined by both a regular
object and a shared object. */
dynsym = FALSE;
- if (! dynamic)
+
+ /* Plugin symbols aren't normal. Don't set def_regular or
+ ref_regular for them, nor make them dynamic. */
+ if ((abfd->flags & BFD_PLUGIN) != 0)
+ ;
+ else if (! dynamic)
{
if (! definition)
{
@@ -4415,10 +4420,6 @@ error_free_dyn:
if (definition && (sec->flags & SEC_DEBUGGING) && !info->relocatable)
dynsym = FALSE;
- /* Nor should we make plugin symbols dynamic. */
- if ((abfd->flags & BFD_PLUGIN) != 0)
- dynsym = FALSE;
-
if (definition)
{
h->target_internal = isym->st_target_internal;
--
Alan Modra
Australia Development Lab, IBM