V2 [PATCH] x86: Support GNU_PROPERTY_X86_ISA_1_V[234] marker:

H.J. Lu hjl.tools@gmail.com
Wed Oct 7 17:36:36 GMT 2020


On Wed, Oct 7, 2020 at 5:54 AM H.J. Lu <hjl.tools@gmail.com> wrote:
>
> On Wed, Oct 7, 2020 at 2:22 AM Florian Weimer <fweimer@redhat.com> wrote:
> >
> > * H. J. Lu via Binutils:
> >
> > > GCC 11 supports -march=x86-64-v[234] to enable x86 micro-architecture ISA
> > > levels:
> > >
> > > https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97250
> > >
> > > Update GNU_PROPERTY_X86_ISA_1_XXX macros:
> > >
> > > https://gitlab.com/x86-psABIs/x86-64-ABI/-/merge_requests/13
> > >
> > > in x86 ELF binaries to indicate that micro-architecture ISA levels
> > > required to execute the binary:
> > >
> > >  #define GNU_PROPERTY_X86_ISA_1_NEEDED (GNU_PROPERTY_X86_UINT32_OR_LO + 2)
> > >  #define GNU_PROPERTY_X86_ISA_1_USED (GNU_PROPERTY_X86_UINT32_OR_AND_LO + 2)
> > >  #define GNU_PROPERTY_X86_ISA_1_V2 (1U << 0)
> > >  #define GNU_PROPERTY_X86_ISA_1_V3 (1U << 1)
> > >  #define GNU_PROPERTY_X86_ISA_1_V4 (1U << 2)
> > >
> > > The previous GNU_PROPERTY_X86_ISA_1_XXX  macros are deprecated and renamed
> > > to GNU_PROPERTY_X86_COMPAT_2_ISA_1_XXX.
> > >
> > > Also add
> > >
> > >  #define GNU_PROPERTY_X86_FEATURE_2_MASK (1U << 11)
> > >
> > > for mask registers.
> >
> > I'm not sure if this is the right way to do this.  How is the level
> > markup going to be used?
>
> What happens when a x86-64-v4 shared library is placed in the
> x86-64-v2 directory by mistake on a x86-64-v2 machine?   The
> program may run for a while and then crashes on x86-64-v4 instructions.
> With a GNU_PROPERTY_X86_ISA_1_V[234] marker, ld.so can skip
> such incompatible libraries and avoid crash.  You can think of it as another
> level of EM_XXX.
>
> > We might eventually store allocated notes in /etc/ld.so.conf and use
> > them to select a shared object implementation based on which objects the
> > dynamic linker sees as matching the requirement.  There is still the
> > matter of choosing between different eligible implementations.  Maybe a
> > simple priority field could help with that.  But I don't think it should
> > replace a requirement to match ISAs.
>

Here is the updated patch with -z x86-64-v[234] linker command line
option to mark x86-64-v[234] ISA level as needed.

-- 
H.J.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-x86-Support-GNU_PROPERTY_X86_ISA_1_V-234-marker.patch
Type: text/x-patch
Size: 163630 bytes
Desc: not available
URL: <https://sourceware.org/pipermail/binutils/attachments/20201007/f983872a/attachment-0001.bin>


More information about the Binutils mailing list