public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
From: "H. J. Lu" <hjl@lucon.org>
To: binutils@sources.redhat.com
Cc: matz@suse.de
Subject: PATCH: PR ld/2342: linkonce debug is broken
Date: Mon, 24 Apr 2006 20:12:00 -0000	[thread overview]
Message-ID: <20060424175253.GA21687@lucon.org> (raw)

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;

             reply	other threads:[~2006-04-24 18:22 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-04-24 20:12 H. J. Lu [this message]
2006-04-25 15:47 ` PATCH: Cache the result of _bfd_elf_check_kept_section H. J. Lu
2006-04-25 16:11   ` H. J. Lu
2006-04-25 16:37     ` 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=20060424175253.GA21687@lucon.org \
    --to=hjl@lucon.org \
    --cc=binutils@sources.redhat.com \
    --cc=matz@suse.de \
    /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).