This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: PATCH: PR ld/2723: ld puts unused section symbols in symbol table


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]