[PATCH] x86: Don't remove empty x86 properties

H.J. Lu hjl.tools@gmail.com
Thu Dec 6 22:20:00 GMT 2018


On Thu, Dec 6, 2018 at 1:21 PM Cary Coutant <ccoutant@gmail.com> wrote:
>
> > Let's take GNU_PROPERTY_X86_FEATURE_2_USED.  Here are
> > what x86-64 psABI says:
>
> OK. Pay particular attention to the parts I've highlighted...
>
> > GNU_PROPERTY_X86_FEATURE_2_USED GNU_PROPERTY_X86_UINT32_OR_AND_LO + 1
> >
> > GNU_PROPERTY_X86_FEATURE_2_USED The x86 processor features
> > indicated by the corresponding bits are used in program.
> > *** THEIR SUPPORT IN THE HARDWARE IS OPTIONAL. ***
> > Its absence in an x86 ELF binary implies that any x86 processor
> > features may be used. GNU_PROPERTY_X86_FEATURE_2_USED can be used
> > to check for features used in the program.
>
> Earlier in this thread [1], you said:
>
> > AND and OR_AND are used for different purposes:
> > 1.  AND:  It is OK if run-time doesn't have the feature the
> > program supports, like CET.
> > 2. OR_AND: *** IT IS NOT OK IF RUN-TIME DOESN'T HAVE THE FEATURE
> > THE PROGRAM REQUIRES, LIKE NEEDED AVX512 ***
> >
> > OR is informational, like used AVX512:
> >
> > 1 bit: Yes. 0 bit: Unknown.
> >
> > AND and OR_AND are useful for loaders and must be originated by
> > compiler or programmer.   *** OR MAY BE GENERATED AUTOMATICALLY
> > BY ASSEMBLER. ***
>
> You say USED bits correspond to features that are optional, but you
> say OR_AND is for features that are required. You say OR may be
> generated automatically by the assembler, but you have the assembler
> generating the USED bits automatically. You say OR_AND must be
> originated by the compiler or programmer -- those are clearly for the
> NEEDED features, since the assembler cannot automatically determine
> whether the use of an instruction is guarded by a CPUID check.
>
> -cary
>
> [1] https://sourceware.org/ml/binutils/2018-11/msg00238.html

I misspoke in [1].  x86-64 psABI describes the correct behavior.

-- 
H.J.



More information about the Binutils mailing list