This is the mail archive of the
mailing list for the glibc project.
Re: RFC: Linux gABI: Add a GNU_PROPERTY_BY_LINKER property
- From: Cary Coutant <ccoutant at gmail dot com>
- To: "H.J. Lu" <hjl dot tools at gmail dot com>
- Cc: Florian Weimer <fweimer at redhat dot com>, Binutils <binutils at sourceware dot org>, GNU C Library <libc-alpha at sourceware dot org>, gnu-gabi at sourceware dot org, x86-64-abi <x86-64-abi at googlegroups dot com>
- Date: Mon, 26 Nov 2018 14:33:50 -0800
- Subject: Re: RFC: Linux gABI: Add a GNU_PROPERTY_BY_LINKER property
- References: <CAMe9rOqk-s5LHb0dAOZJ=GdLeUgqY-sdx3GLBLeBsnM=kU1dZQ@mail.gmail.com> <email@example.com> <CAMe9rOrk8DoAJ8Qusy3ZrzSx-ZwERiaPvbwARKnzW7QzELWRGQ@mail.gmail.com>
> > > GNU_PROPERTY_X86_UINT32_VALID was defined to address this issue such that
> > > linker sets the bit in values of x86 properties for non-relocatable
> > > outputs. But it isn't sufficient:
> > >
> > > 1. It doesn't cover generic properties.
> > Okay.
Does this imply that the property notes in all pre-existing binaries
can't be trusted?
> > > 2. When -mx86-used-note=yes is passed to x86 assembler, the
> > > GNU_PROPERTY_X86_UINT32_VALID bit is set in GNU_PROPERTY_X86_ISA_1_USED
> > > property in object file and linkers without GNU property support generate
> > > invalid NT_GNU_PROPERTY_TYPE_0 notes with the GNU_PROPERTY_X86_UINT32_VALID
> > > bit set.
> > Surely this is a GAS bug? Why not fix that bug?
> Linker removes GNU_PROPERTY_X86_ISA_1_USED when its value is empty.
> Maybe linker shouldn't do that.
Please explain how that answers Florian's question? You lost me.
What exactly are you saying the linker should not do? In your Aug. 10
proposal, ISA_1_USED is in the UINT32_OR_AND range, which specifically
says the bit should only be set in the output if *all* input files
contain the property (although it's unclear whether you meant "this
property is present in all relocatable input files" to mean a non-zero
property in all input files).
> > > 1. Add a GNU_PROPERTY_BY_LINKER property which should only be set by
> > > linker for non-relocatable outputs to indicate the property note is
> > > valid and generated by new linkers. Loaders can check this property
> > > to verify that the property note is valid.
> > > 2. Remove GNU_PROPERTY_X86_UINT32_VALID.
> > > 3. Define GNU_PROPERTY_X86_ISA_1_BASE for GNU_PROPERTY_X86_ISA_1_USED,
> > > which has the same bit as GNU_PROPERTY_X86_UINT32_VALID and use it
> > > for -mx86-used-note=yes with x86 assembler.
> > The alternative approach would be to switch to a new PT_ segment for
> > this because those aren't included in relocatable objects. (Maybe it's
> > time for another approach.)
> PT_NOTE is used so that binaries with GNU properties are backward
> compatible with loaders which don't support GNU properties. They will
> run without any new features from GNU properties.
With both your Aug. 10 proposal and this one, you're throwing
compatibility out the window by saying the loader shouldn't trust
those old notes without VALID bits. Can't we use this opportunity to
just do it right? At this point, I don't really care if you keep on
using SHT_NOTE for the properties in relocatable files, but please,
let's use a proper PT_GNU_PROPERTY segment for executables. (Sorry, I
promised to yield to the consensus, but the design keeps getting more