From: Alan Modra <amodra@gmail.com>
To: "H.J. Lu" <hjl.tools@gmail.com>
Cc: Binutils <binutils@sourceware.org>
Subject: Re: RFC: PATCH: ld/12942: Plugin not handling correctly resolution of COMDATs.
Date: Sat, 09 Jul 2011 06:35:00 -0000 [thread overview]
Message-ID: <20110709062126.GI26365@bubble.grove.modra.org> (raw)
In-Reply-To: <CAMe9rOqYfuLm8svQO7OPV-4w=_jtMEyYd9739HDEdSb0yh5pbQ@mail.gmail.com>
Now that I've had time to properly look at this problem, I believe
much of your patch isn't needed. Everything related to
SEC_LTO_COMDAT and GNU_LTO_COMDAT_SECTION_NAME, and the changes to
plugin_notice are all working around a bug uncovered by the
section_already_linked change. I'm about to install the following
patch along with your changes related to section_already_linked.
(Another approach would be to use elf_discarded_section in
plugin_notice, but it's neater to catch the real problem at the
source.)
bfd/
2011-07-09 Alan Modra <amodra@gmail.com>
PR ld/12942
* elflink.c (elf_link_add_object_symbols): Use elf_discarded_section
rather than kept_section to determine whether a symbol is from
a discarded section.
* cofflink.c (coff_link_add_symbols): Make symbols from discarded
sections appear undefined.
2011-07-09 H.J. Lu <hongjiu.lu@intel.com>
PR ld/12942
* elf-bfd.h (_bfd_elf_section_already_linked): Replace
"asection *" with "struct already_linked *".
* libbfd-in.h (_bfd_nolink_section_already_linked): Likewise.
(_bfd_generic_section_already_linked): Likewise.
(bfd_section_already_linked_table_insert): Likewise.
(struct already_linked): New.
(struct bfd_section_already_linked): Use it.
* elflink.c (_bfd_elf_section_already_linked): Replace.
"asection *" with "struct already_linked *". Replace the plugin
dummy with the LTO output.
* linker.c (_bfd_generic_section_already_linked): Likewise.
* targets.c (struct already_linked): Add forward declaration.
(bfd_target): Replace "struct bfd_section *" with
"struct already_linked *" in _section_already_linked.
* bfd-in2.h: Regenerate.
* libbfd.h: Regenerate.
include/
2011-07-09 H.J. Lu <hongjiu.lu@intel.com>
PR ld/12942
* bfdlink.h (bfd_link_info): Add loading_lto_outputs.
ld/
2011-07-09 H.J. Lu <hongjiu.lu@intel.com>
PR ld/12942
* ldlang.c (section_already_linked): Pass "struct already_linked *"
to bfd_section_already_linked.
(lang_process): Set link_info.loading_lto_outputs before
loading LTO outputs.
* plugin.c: Include "libbfd.h".
(add_symbols): Call bfd_section_already_linked with comdat_key.
Index: bfd/elflink.c
===================================================================
RCS file: /cvs/src/src/bfd/elflink.c,v
retrieving revision 1.412
diff -u -p -r1.412 elflink.c
--- bfd/elflink.c 21 Jun 2011 14:55:26 -0000 1.412
+++ bfd/elflink.c 8 Jul 2011 13:49:04 -0000
@@ -3900,7 +3900,7 @@ error_free_dyn:
sec = bfd_section_from_elf_index (abfd, isym->st_shndx);
if (sec == NULL)
sec = bfd_abs_section_ptr;
- else if (sec->kept_section)
+ else if (elf_discarded_section (sec))
{
/* Symbols from discarded section are undefined. We keep
its visibility. */
Index: bfd/cofflink.c
===================================================================
RCS file: /cvs/src/src/bfd/cofflink.c,v
retrieving revision 1.77
diff -u -p -r1.77 cofflink.c
--- bfd/cofflink.c 13 Jun 2011 00:59:09 -0000 1.77
+++ bfd/cofflink.c 9 Jul 2011 03:17:55 -0000
@@ -392,7 +392,11 @@ coff_link_add_symbols (bfd *abfd,
section = coff_section_from_bfd_index (abfd, sym.n_scnum);
if (! obj_pe (abfd))
value -= section->vma;
- break;
+ /* Treat a symbol from a discarded section as undefined. */
+ if (bfd_is_abs_section (section)
+ || !bfd_is_abs_section (section->output_section))
+ break;
+ /* Fall thru */
case COFF_SYMBOL_UNDEFINED:
flags = 0;
--
Alan Modra
Australia Development Lab, IBM
next prev parent reply other threads:[~2011-07-09 6:21 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-07-04 22:58 H.J. Lu
2011-07-05 8:55 ` Hans-Peter Nilsson
2011-07-06 3:27 ` Alan Modra
2011-07-06 5:13 ` H.J. Lu
2011-07-09 6:35 ` Alan Modra [this message]
2011-07-12 0:01 ` Mike Frysinger
2011-07-12 0:09 ` H.J. Lu
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20110709062126.GI26365@bubble.grove.modra.org \
--to=amodra@gmail.com \
--cc=binutils@sourceware.org \
--cc=hjl.tools@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).