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: Do we need section symbols for .shstrtab, .symtab, .strtab?


On Wed, May 31, 2006 at 05:40:53PM -0700, H. J. Lu wrote:
> Do we need section symbols for .shstrtab, .symtab, .strtab in
> executable and shared library?

I don't think so.  In fact, we probably don't need any section syms in
the normal symtab if not emitting relocs.  Hmm, unless gdb (or other
tools like oprofile) use them for something..  Getting rid of the syms
in special elf sections is easy, but unfortunately means fixing rather a
lot of ld tests that match the symbol table.

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	1 Jun 2006 02:31:20 -0000
@@ -8128,10 +8128,11 @@ bfd_elf_final_link (bfd *abfd, struct bf
       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);
+	  if (o == NULL)
+	    continue;
+	  o->target_index = bfd_get_symcount (abfd);
 	  elfsym.st_shndx = i;
-	  if (info->relocatable || o == NULL)
+	  if (info->relocatable)
 	    elfsym.st_value = 0;
 	  else
 	    elfsym.st_value = o->vma;

-- 
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]