This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
[patch bfd]: Adjust handling for plugin-generated sections for pe-coff targets
- From: Kai Tietz <ktietz70 at googlemail dot com>
- To: Binutils <binutils at sourceware dot org>
- Date: Tue, 27 Sep 2011 14:37:22 +0200
- Subject: [patch bfd]: Adjust handling for plugin-generated sections for pe-coff targets
Hello,
this patch takes care that in combination with LTO-plugin no errors
getting emitted for relocations to discared sections coming from plugin.
This can happen by linking objects and a library providing same symbol-name
on command-line, and this symbol is referenced in other objects of the
library, too.
2011-09-27 Kai Tietz <ktietz@redhat.com>
* cofflink.c (_bfd_coff_link_input_bfd): Ignore
excluded input-sections.
Additionally ignore emitting of errors for relocations to
excluded section, if their owner is plugin.
Regression tested for x86_64-w64-mingw32, i686-w64-mingw32, and i686-pc-cygwin.
Ok for apply?
Regards,
Kai
Index: bfd/cofflink.c
===================================================================
RCS file: /cvs/src/src/bfd/cofflink.c,v
retrieving revision 1.79
diff -u -r1.79 cofflink.c
--- bfd/cofflink.c 17 Aug 2011 00:39:38 -0000 1.79
+++ bfd/cofflink.c 27 Sep 2011 11:21:47 -0000
@@ -2318,7 +2327,9 @@
if ((o->flags & SEC_LINKER_CREATED) != 0)
continue;
-
+ if (!bfd_is_abs_section (o)
+ && o->output_section == bfd_abs_section_ptr)
+ continue;
if ((o->flags & SEC_HAS_CONTENTS) == 0
|| (o->size == 0 && (o->flags & SEC_RELOC) == 0))
{
@@ -2386,7 +2397,10 @@
if (ps == NULL)
continue;
/* Complain if definition comes from an excluded section. */
- if (ps->flags & SEC_EXCLUDE)
+ if ((ps->flags & SEC_EXCLUDE) != 0
+ && (ps->owner->flags & BFD_PLUGIN) == 0
+ && !bfd_is_abs_section (ps)
+ && bfd_is_abs_section ((ps)->output_section))
(*finfo->info->callbacks->einfo)
(_("%X`%s' referenced in section `%A' of %B: "
"defined in discarded section `%A' of %B\n"),