RFC: Remove sec->name and bfd_section_name
H. J. Lu
hjl@lucon.org
Mon May 24 15:39:00 GMT 2004
On Mon, May 24, 2004 at 11:02:41AM +0200, Jakub Jelinek wrote:
> On Mon, May 24, 2004 at 08:18:11PM +0930, Alan Modra wrote:
> > bfd/ChangeLog
> > * elflink.c (elf_link_add_object_symbols): Don't set up merge
> > section data here..
> > * elf.c (_bfd_elf_merge_sections): .. Do it here instead.
> > * merge.c (_bfd_merge_section): Update comment. Don't test
> > section name to determine sinfo group, instead test output
> > section.
> > ld/ChangeLog
> > * ldlang.c (lang_process): Call bfd_merge_sections later, and
> > only when not a relocatable link.
>
> Actually, thinking about it more, the name check is desirable.
> Consider say .rodata.str1.1 and .rodata.str1.32 sections GCC used to
> emit until very recently on IA-32. These sections have both sh_entsize 1,
> SHF_MERGE|SHF_STRINGS, the same output section (.rodata), yet you don't
> want to merge them together because of the different alignment rules.
> If they are merged together, then I'm afraid several strings from the
> .rodata.str1.1 input sections will suddenly be forced to have 32-byte
> alignment unnecessarily.
>
> Cannot we use the output_section check AND name comparison?
I am working on a patch to get rid of sec->name. Please use
bfd_get_section_name for section name.
BTW, we have both
#define bfd_get_section_name(bfd, ptr) ((ptr)->name + 0)
#define bfd_section_name(bfd, ptr) ((ptr)->name)
Their usages are very inconsistent. I am planning to rename
#define bfd_section_name(bfd, ptr) ((ptr)->name)
to
#define bfd_section_ident(bfd, ptr) ((ptr)->name)
and add
#define bfd_set_section_name(bfd, ptr, name) ((ptr)->name = (name), TRUE)
We should use bfd_section_ident for the section identifier. I will
change bfd_section_ident to a target function later so that it will
support multiple sections with the same name.
H.J.
More information about the Binutils
mailing list