This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
PATCH: PR ld/2342: linkonce debug is broken
- From: "H. J. Lu" <hjl at lucon dot org>
- To: binutils at sources dot redhat dot com
- Cc: matz at suse dot de
- Date: Mon, 24 Apr 2006 10:52:53 -0700
- Subject: PATCH: PR ld/2342: linkonce debug is broken
This patch addresses the link speed issue by caching the result of
_bfd_elf_check_kept_section.
H.J.
----
2006-02-17 Michael Matz <matz@suse.de>
H.J. Lu <hongjiu.lu@intel.com>
* elf-bfd.h (bfd_elf_section_data): Add kept_section.
(elf_kept_section): New.
* elf.c (_bfd_elf_new_section_hook): Initialize
elf_kept_section to (asection *) -1L.
* elflink.c (_bfd_elf_check_kept_section): Cache the result in
elf_kept_section.
2006-02-17 H.J. Lu <hongjiu.lu@intel.com>
PR ld/2342
* elflink.c (_bfd_elf_default_action_discarded): Undo the
change made on 2006-02-16.
(elf_link_input_bfd): Likewise.
Index: bfd/elflink.c
===================================================================
RCS file: /cvs/src/src/bfd/elflink.c,v
retrieving revision 1.202
retrieving revision 1.201
diff -u -p -r1.202 -r1.201
--- bfd/elflink.c 15 Feb 2006 14:12:54 -0000 1.202
+++ bfd/elflink.c 17 Jan 2006 15:32:40 -0000 1.201
@@ -6691,7 +6691,7 @@ unsigned int
_bfd_elf_default_action_discarded (asection *sec)
{
if (sec->flags & SEC_DEBUGGING)
- return 0;
+ return PRETEND;
if (strcmp (".eh_frame", sec->name) == 0)
return 0;
@@ -7007,7 +7007,8 @@ elf_link_input_bfd (struct elf_final_lin
from discarded sections and section symbols from
removed link-once sections. Complain about relocs
against discarded sections. Zero relocs against removed
- link-once sections. */
+ link-once sections. Preserve debug information as much
+ as we can. */
if (!elf_section_ignore_discarded_relocs (o))
{
Elf_Internal_Rela *rel, *relend;
@@ -7079,11 +7080,16 @@ elf_link_input_bfd (struct elf_final_lin
sym_name, o, input_bfd, sec, sec->owner);
/* Try to do the best we can to support buggy old
- versions of gcc. Pretend that the symbol is
+ versions of gcc. If we've warned, or this is
+ debugging info, pretend that the symbol is
really defined in the kept linkonce section.
FIXME: This is quite broken. Modifying the
symbol here means we will be changing all later
- uses of the symbol, not just in this section. */
+ uses of the symbol, not just in this section.
+ The only thing that makes this half reasonable
+ is that we warn in non-debug sections, and
+ debug sections tend to come after other
+ sections. */
if (action & PRETEND)
{
asection *kept;