RFC: [PATCH] ELF: Don't require section header on ELF objects
H.J. Lu
hjl.tools@gmail.com
Sun Mar 8 23:46:51 GMT 2020
On Sun, Mar 8, 2020 at 4:35 PM Alan Modra <amodra@gmail.com> wrote:
>
> On Sun, Mar 08, 2020 at 11:06:33AM -0700, H.J. Lu wrote:
> > On Sun, Mar 8, 2020 at 10:59 AM H.J. Lu <hjl.tools@gmail.com> wrote:
> > >
> > > Any comments?
> > >
> > > Kaylee, do you have copyright paper with FSF?
> > >
> > > H.J.
> > > ---
> > > Section header isn't mandatory on ELF executable nor shared library.
> > > This patch adds a new linker option, -z nosectionheader, to omit ELF
> > > section header when building an executable or shared library, adds
> > > an objcopy and strip option, --remove-section-header, to remove ELF
> > > section header from an executable or shared library.
> > >
> > > The PT_DYNAMIC segment contains DT_HASH/DT_GNU_HASH/DT_MIPS_XHASH,
> > > DT_STRTAB, DT_SYMTAB, DT_STRSZ and DT_SYMENT, which can be used to
> > > reconstruct dynamic symbol table when section header isn't available.
> > > For DT_HASH, the number of dynamic symbol table entries equals the
> > > number of chains. For DT_GNU_HASH/DT_MIPS_XHASH, only defined symbols
> > > with non-STB_LOCAL indings are in hash table. Since in dynamic symbol
> > > table, all symbols with STB_LOCAL binding are placed before symbols with
> > > other bindings and all defined symbols are placed before undefined ones,
> >
> > It should read
> >
> > ---
> > all symbols with STB_LOCAL binding are placed
> > before symbols with other bindings and all undefined symbols are placed
> > before defined ones,
> > ---
>
> That's new to me. I don't think there is any ordering in .dynsym
> among non-local symbols.
I will get clarification from gABI group.
> The patch looks OK.
>
--
H.J.
More information about the Binutils
mailing list