This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: [PATCH] x86: Don't remove empty x86 properties
- From: Cary Coutant <ccoutant at gmail dot com>
- To: "H.J. Lu" <hjl dot tools at gmail dot com>
- Cc: x86-64-abi <x86-64-abi at googlegroups dot com>, Binutils <binutils at sourceware dot org>
- Date: Wed, 5 Dec 2018 15:07:08 -0800
- Subject: Re: [PATCH] x86: Don't remove empty x86 properties
- References: <20181126214508.105748-1-hjl.tools@gmail.com> <CAJimCsHhUNTbMrO5uDfkaRVJSGz6QaJK3vBPbbpYGHE0mPirEA@mail.gmail.com> <CAMe9rOqNwUxYTYN1xVdrpSc9VC16tnxAYuzvgJvGAacE6W5eMQ@mail.gmail.com> <CAJimCsHdzQF8dwQUO5Yeg8RjZVOxOmVbdtBXFbLBEqGKnNAV0g@mail.gmail.com> <CAJimCsHwHoiB+mFozJeeL9Cux5-9bJA2Vu0VAAWsDtJGoXUv8w@mail.gmail.com> <CAMe9rOrdHAg6KNLXXvrbkLPxehi6yodOPzchZuHY9B+3ayQ7SA@mail.gmail.com> <CAJimCsH+8X=UC-EaeR0H8iVS67yLc-DK9PzSrHFnzoRP_thNPQ@mail.gmail.com> <CAMe9rOri3Osi9d6db-+EFw3bcp7tWG12ytx5rebcpaVSa2id_A@mail.gmail.com> <CAJimCsEwWqqWxnTNrXZ+AhcBVovjOdb33O=VE2eKpJ6baMHFQA@mail.gmail.com> <CAMe9rOoB5unY6MOL8DmTWDo2gkbwBOHRvj0oxZ2E3SK8t4VO3A@mail.gmail.com> <CAJimCsEuD+Cgq_zSbTMxTPjbPouB9i729FxgaB3=p-ccA=cNtA@mail.gmail.com> <CAMe9rOrwbiAmyL3=KDstQmwrxKVZ6odrma71s_fOx-vUdnPaVg@mail.gmail.com> <CAJimCsFHjvgZaCDmhOPd+1iD_HJqhKmn6jiy72PSXBugt04a6Q@mail.gmail.com> <CAMe9rOoJSUQtWE=BmhXFKsfO=CoB56RK+8uEC25btgoThSN1+w@mail.gmail.com> <CAJimCsHR2ixUqqLAiHvr6j+a3XDOgstbNRcTq_s_82dsNgs01Q@mail.gmail.com> <CAMe9rOoKQsJpkfVauOaYwbydb4OF=dOGq3fmOFW=bjOiyui5Vw@mail.gmail.com> <CAJimCsExxWio=XbjeTFBKiCb1+0h9jmWjfkojns1PCsAtEw5BQ@mail.gmail.com> <CAMe9rOrsBr916FEWZce3FhnpKsNczS0pCo0aj7-7SEQK1aAh6g@mail.gmail.com>
> > The way you've defined the values, ISA_1_USED uses the OR_AND rule,
> > which implements the behavior you want for ISA_1_NEEDED. ISA_1_NEEDED
> > uses the OR rule, which implements the behavior you want for
> > ISA_1_USED. Likewise for FEATURE_2_USED and FEATURE_2_NEEDED.
>
> I committed a typo fix. Now it reads
>
> GNU_PROPERTY_X86_FEATURE_2_NEEDED The x86 processor features in-
> dicated by the corresponding bits are needed in program and they must be
> supported by the hardware. Loader may refuse to load the program whose
> GNU_PROPERTY_X86_FEATURE_2_NEEDED features aren’t supported by the
> hardware.
> GNU_PROPERTY_X86_ISA_1_NEEDED The x86 instruction sets indicated
> by the corresponding bits are needed in program and they must be sup-
> ported by the hardware.
> Loader may refuse to load the program whose
> GNU_PROPERTY_X86_ISA_1_NEEDED ISAs aren’t supported by the hardware.
That doesn't fix a thing. Here's the fix you need:
Table 5.3: Program Property Types
Name Value
GNU_PROPERTY_X86_FEATURE_1_AND GNU_PROPERTY_X86_UINT32_AND_LO + 0
- GNU_PROPERTY_X86_FEATURE_2_USED GNU_PROPERTY_X86_UINT32_OR_AND_LO + 1
+ GNU_PROPERTY_X86_FEATURE_2_USED GNU_PROPERTY_X86_UINT32_OR_LO + 1
- GNU_PROPERTY_X86_FEATURE_2_NEEDED GNU_PROPERTY_X86_UINT32_OR_LO + 1
+ GNU_PROPERTY_X86_FEATURE_2_NEEDED GNU_PROPERTY_X86_UINT32_OR_AND_LO + 1
- GNU_PROPERTY_X86_ISA_1_USED GNU_PROPERTY_X86_UINT32_OR_AND_LO + 0
+ GNU_PROPERTY_X86_ISA_1_USED GNU_PROPERTY_X86_UINT32_OR_LO + 0
- GNU_PROPERTY_X86_ISA_1_NEEDED GNU_PROPERTY_X86_UINT32_OR_LO + 0
+ GNU_PROPERTY_X86_ISA_1_NEEDED GNU_PROPERTY_X86_UINT32_OR_AND_LO + 0
And this:
--- a/bfd/elfxx-x86.c
+++ b/bfd/elfxx-x86.c
@@ -2408,7 +2408,7 @@ _bfd_x86_elf_merge_gnu_properties (struct
bfd_link_info *info,
bfd_boolean updated = FALSE;
unsigned int pr_type = aprop != NULL ? aprop->pr_type : bprop->pr_type;
- if (pr_type == GNU_PROPERTY_X86_COMPAT_ISA_1_USED
+ if (pr_type == GNU_PROPERTY_X86_COMPAT_ISA_1_NEEDED
|| (pr_type >= GNU_PROPERTY_X86_UINT32_OR_AND_LO
&& pr_type <= GNU_PROPERTY_X86_UINT32_OR_AND_HI))
{
@@ -2426,7 +2426,7 @@ _bfd_x86_elf_merge_gnu_properties (struct
bfd_link_info *info,
}
goto or_property;
}
- else if (pr_type == GNU_PROPERTY_X86_COMPAT_ISA_1_NEEDED
+ else if (pr_type == GNU_PROPERTY_X86_COMPAT_ISA_1_USED
|| (pr_type >= GNU_PROPERTY_X86_UINT32_OR_LO
&& pr_type <= GNU_PROPERTY_X86_UINT32_OR_HI))
{
-cary