[PATCH] ELF: Add support for unique section ID to assembler
Alan Modra
amodra@gmail.com
Mon Feb 3 00:22:00 GMT 2020
On Sun, Feb 02, 2020 at 09:50:54AM -0800, H.J. Lu wrote:
> Clang's integrated assembler supports multiple section with the same
> name:
>
> .section .text,"ax",@progbits,unique,1
> nop
> .section .text,"ax",@progbits,unique,2
> nop
>
> "unique,N" assigns the number, N, as the section ID, to a section. The
> valid values of the section ID are between 0 and 4294967295. It can be
> used to distinguish different sections with the same section name.
>
> This is useful with -fno-unique-section-names -ffunction-sections.
> -ffunction-sections by default generates .text.foo, .text.bar, etc.
> Using the same string can save lots of space in .strtab.
>
> This patch adds section_id to bfd_section and reuses the linker
> internal bit in BFD section flags, SEC_LINKER_CREATED, for assmebler
> internal use to mark valid section_id. It also updates objdump to
> compare section pointers if 2 sections comes from the same file since
> 2 different sections can have the same section name.
Looks OK to me.
--
Alan Modra
Australia Development Lab, IBM
More information about the Binutils
mailing list