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?
On Thu, Jun 01, 2006 at 12:22:11PM +0930, Alan Modra wrote:
> 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
objcopy/strip already remove them since
http://sourceware.org/ml/binutils/2006-05/msg00458.html
> in special elf sections is easy, but unfortunately means fixing rather a
> lot of ld tests that match the symbol table.
I don't think it should block removing unused entries in 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;
I don't think it is correct. It will skip SHN_LORESERVE/SHN_HIRESERVE
adjustment.
> + 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;
>
H.J.