This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: Do we need section symbols for .shstrtab, .symtab, .strtab?
- From: Alan Modra <amodra at bigpond dot net dot au>
- To: "H. J. Lu" <hjl at lucon dot org>
- Cc: binutils at sources dot redhat dot com
- Date: Thu, 1 Jun 2006 12:22:11 +0930
- Subject: Re: Do we need section symbols for .shstrtab, .symtab, .strtab?
- References: <20060601004053.GA17886@lucon.org>
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