public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
From: Alan Modra <amodra@bigpond.net.au>
To: "H. J. Lu" <hjl@lucon.org>
Cc: binutils@sources.redhat.com
Subject: Re: PATCH: PR ld/2723: ld puts unused section symbols in symbol table
Date: Fri, 02 Jun 2006 02:30:00 -0000	[thread overview]
Message-ID: <20060602003515.GB26009@bubble.grove.modra.org> (raw)
In-Reply-To: <20060601201627.GA25377@lucon.org>

On Thu, Jun 01, 2006 at 01:16:27PM -0700, H. J. Lu wrote:
> Here is the patch.  It just makes ld close to objcopy when handling
> section symbols.

Thanks very much for doing this.  I committed a slightly different
elflink.c change.

Index: bfd/elflink.c
===================================================================
RCS file: /cvs/src/src/bfd/elflink.c,v
retrieving revision 1.216
diff -u -p -r1.216 elflink.c
--- bfd/elflink.c	24 May 2006 17:10:01 -0000	1.216
+++ bfd/elflink.c	2 Jun 2006 00:29:31 -0000
@@ -8125,18 +8125,19 @@ bfd_elf_final_link (bfd *abfd, struct bf
       elfsym.st_size = 0;
       elfsym.st_info = ELF_ST_INFO (STB_LOCAL, STT_SECTION);
       elfsym.st_other = 0;
+      elfsym.st_value = 0;
       for (i = 1; i < elf_numsections (abfd); i++)
 	{
 	  o = bfd_section_from_elf_index (abfd, i);
 	  if (o != NULL)
-	    o->target_index = bfd_get_symcount (abfd);
-	  elfsym.st_shndx = i;
-	  if (info->relocatable || o == NULL)
-	    elfsym.st_value = 0;
-	  else
-	    elfsym.st_value = o->vma;
-	  if (! elf_link_output_sym (&finfo, NULL, &elfsym, o, NULL))
-	    goto error_return;
+	    {
+	      o->target_index = bfd_get_symcount (abfd);
+	      elfsym.st_shndx = i;
+	      if (!info->relocatable)
+		elfsym.st_value = o->vma;
+	      if (!elf_link_output_sym (&finfo, NULL, &elfsym, o, NULL))
+		goto error_return;
+	    }
 	  if (i == SHN_LORESERVE - 1)
 	    i += SHN_HIRESERVE + 1 - SHN_LORESERVE;
 	}

-- 
Alan Modra
IBM OzLabs - Linux Technology Centre

  reply	other threads:[~2006-06-02  0:35 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-06-01  0:41 Do we need section symbols for .shstrtab, .symtab, .strtab? H. J. Lu
2006-06-01  2:52 ` Alan Modra
2006-06-01  5:37   ` H. J. Lu
2006-06-01  6:08     ` Alan Modra
2006-06-02  0:35   ` PATCH: PR ld/2723: ld puts unused section symbols in symbol table H. J. Lu
2006-06-02  2:30     ` Alan Modra [this message]
2006-06-02  8:49       ` Alan Modra

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=20060602003515.GB26009@bubble.grove.modra.org \
    --to=amodra@bigpond.net.au \
    --cc=binutils@sources.redhat.com \
    --cc=hjl@lucon.org \
    /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).