[RFC] Symbol meta-information ELF extension

Jozef Lawrynowicz jozef.l@mittosystems.com
Tue Feb 18 18:55:00 GMT 2020
On Tue, 18 Feb 2020 06:50:58 -0800
"H.J. Lu" <hjl.tools@gmail.com> wrote:

> On Tue, Feb 18, 2020 at 6:38 AM Jozef Lawrynowicz
> <jozef.l@mittosystems.com> wrote:
> >
> > On Tue, 18 Feb 2020 05:58:34 -0800
> > "H.J. Lu" <hjl.tools@gmail.com> wrote:
> >  
> > > On Tue, Feb 18, 2020 at 5:47 AM Jozef Lawrynowicz
> > > <jozef.l@mittosystems.com> wrote:  
> > > >
> > > > On Tue, 18 Feb 2020 04:58:02 -0800
> > > > "H.J. Lu" <hjl.tools@gmail.com> wrote:
> > > >  
> > > > > On Tue, Feb 18, 2020 at 2:26 AM Jozef Lawrynowicz
> > > > > <jozef.l@mittosystems.com> wrote:  
> > > > > >
> > > > > > Hi,
> > > > > >
> > > > > > I've been working with Texas Instruments to develop an ELF extension which
> > > > > > allows additional information about symbols ("symbol meta-information") to
> > > > > > be stored in ELF files, in a section called .symtab_meta.
> > > > > >
> > > > > > The aim of symbol meta-information is to provide a extensible format for
> > > > > > propagating additional information about symbols from the source code through to
> > > > > > the link stage.
> > > > > >
> > > > > > I hope I can get some feedback on this proposal, and its current implementation,
> > > > > > from the upstream community so I can make any adjustments required for the
> > > > > > eventual upstreaming of this feature.  
> > > > >
> > > > > Have you looked at Solaris syminfo section
> > > > >
> > > > > https://docs.oracle.com/cd/E26502_01/html/E26507/chapter7-17.html
> > > > >
> > > > > Can you extend it to do what you want?
> > > > >  
> > > >
> > > > It looks like there is only some minimal support for the Syminfo section in
> > > > Binutils. The support is only there so that readelf can dump information about
> > > > the Syminfo section from an object file.
> > > >
> > > > There's no implementation to enable the creation of a Syminfo section with
> > > > user-specified flags for certain symbols, nor are there any hooks into any
> > > > other Binutils programs, so I can't see any advantage to try and leverage that
> > > > existing functionality.  
> > >
> > > syminfo is a very useful ELF extension.  My question is if binutils supports
> > > syminfo, can it be extended to meet your need?
> > >
> > >  
> >
> > Well, a syminfo entry has a field to store flags which describes the extra
> > information about the symbol, similar to the "kind" field of a symbol
> > meta-information entry.
> >
> > typedef struct {
> >         Elf64_Half      si_boundto;
> >         Elf64_Half      si_flags;
> > } Elf64_Syminfo;
> >
> > Meanwhile, syminfo augments the si_flags value by using si_boundto to point
> > to an index in the .dynamic section. This is similar to how the "value" field of
> > a symbol meta-information entry augments its "kind" field, but this
> > functionality must work in static executables which do not have a .dynamic
> > section.
> >
> > So one way to extend syminfo to meet the general need of this proposed symbol
> > meta-information functionality then we would need a new field to store the
> > value associated with the "si_flags".
> >
> > typedef struct {
> >         Elf64_Half      si_boundto;
> >         Elf64_Half      si_flags;
> >         Elf64_Addr      si_value;
> > } Elf64_Syminfo_new;  
> 
> You should start a discussion to extend ELF symbol info at
> 
> https://groups.google.com/forum/#!forum/generic-abi

Thanks for the suggestion. I'll work with TI to get something posted there soon.

Can you clarify whether you still think this would work best as an extension to
Solaris Syminfo?

To be honest I have a problem with that given that Syminfo is a target specific
extension to ELF (which just happens to be implemented in a generic way in
Readelf), and we want to add symbol meta-information as a generic extension
to ELF.

There's no advantage to building upon Syminfo in Binutils given the
implementation is limited to readelf dumping the Syminfo table.

If Syminfo was already part of the gABI I would be on board with working from
that to add the new functionality.

I guess the other option is to take Syminfo, extend it with the new
functionality we want, then propose it as generic ELF extension. I wonder if
there would be legal issues doing all that without any input from Oracle.

Do they "own" the spec? Would I be able to propose their spec with some
extensions to ELF gABI? (These are somewhat rhetorical questions...)

Regards,
Jozef
> 
> > But there are more caveats given that I've worked from a spec which has been
> > followed for an implementation in Clang/LLVM, so if in Binutils we base the
> > symbol meta-information functionality off Solaris syminfo we lose compatibility
> > with this other tool.
> >
> > Even though adding the above si_value field would meet the *general* need of
> > the new implementation, the implementation details between the syminfo and
> > symbol meta-information are very different.
> >
> > I do understand the desire not to fragment Binutils with multiple
> > implementations of similar functionality.
> >
> > If this will be a sticking point for upstreaming then I will need to consider
> > some other options. A key aim of the upstreaming effort of this functioniality
> > is that the GNU and Clang/LLVM implementations are compatible.
> >
> > Thanks,
> > Jozef  
> 
> 
> 



More information about the Binutils mailing list