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: "H.J. Lu" <hjl dot tools at gmail dot com>
- To: Cary Coutant <ccoutant at gmail dot com>
- Cc: x86-64-abi at googlegroups dot com, Binutils <binutils at sourceware dot org>
- Date: Thu, 6 Dec 2018 05:37:27 -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> <CAJimCsEYfFvDNfZ2+dNZEDSWmHAzzuzXbL3yohus_OFu9G-zTw@mail.gmail.com> <CAMe9rOpLVcMz-ONEYWZ0nhcg+Bsc6yoeb42ktUbijG3i_kb2Ew@mail.gmail.com> <CAJimCsF0OJU=cwkftmm_T9AZVaiomFp4fNKErNeN7gmVSMTGKg@mail.gmail.com>
On Wed, Dec 5, 2018 at 4:24 PM Cary Coutant <ccoutant@gmail.com> wrote:
>
> > That is not right. It should be
> >
> > 1. USED follows OR_AND.
> > 2. NEEDED follows OR,
> >
> > Can you point me where x86-64 psABI says otherwise?
>
> I have done so several times:
>
> https://sourceware.org/ml/binutils/2018-11/msg00263.html
> https://sourceware.org/ml/binutils/2018-12/msg00008.html
> https://sourceware.org/ml/binutils/2018-12/msg00045.html
> https://sourceware.org/ml/binutils/2018-12/msg00048.html
>
Let's take GNU_PROPERTY_X86_FEATURE_2_USED. Here are
what x86-64 psABI says:
GNU_PROPERTY_X86_UINT32_OR_AND_LO..GNU_PROPERTY_X86_UINT32_OR_AND_HI
A bit in the output pr_data field is set if it is set in any
relocatable input pr_data
fields and this property is present in all relocatable input files. A
missing property
implies that its bits have unknown values. When all bits in the the
output pr_data
field are zero, this property should not be removed from output to
indicate it has
zero in all bits. If the property is in output, all input relocatables
have the property.
If the bit is 1, some input relocatables have the feature. If the bit
is 0, none of input
relocatables have the feature.
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
[hjl@gnu-cfl-1 tmp]$ cat foo.s
.text
movaps %xmm0, %xmm0
[hjl@gnu-cfl-1 tmp]$ as -mx86-used-note=no foo.s -o foo1.o
[hjl@gnu-cfl-1 tmp]$ as -mx86-used-note=yes foo.s -o foo2.o
[hjl@gnu-cfl-1 tmp]$ as -mx86-used-note=yes foo.s -o foo3.o
[hjl@gnu-cfl-1 tmp]$ readelf -n foo1.o
[hjl@gnu-cfl-1 tmp]$ readelf -n foo2.o
Displaying notes found in: .note.gnu.property
Owner Data size Description
GNU 0x00000020 NT_GNU_PROPERTY_TYPE_0
Properties: x86 ISA used: SSE
x86 feature used: x86, XMM
[hjl@gnu-cfl-1 tmp]$ readelf -n foo3.o
Displaying notes found in: .note.gnu.property
Owner Data size Description
GNU 0x00000020 NT_GNU_PROPERTY_TYPE_0
Properties: x86 ISA used: SSE
x86 feature used: x86, XMM
[hjl@gnu-cfl-1 tmp]$ ld.bfd foo1.o foo2.o
ld.bfd: warning: cannot find entry symbol _start; defaulting to 0000000000401000
[hjl@gnu-cfl-1 tmp]$ readelf -n a.out
[hjl@gnu-cfl-1 tmp]$ ld.bfd foo3.o foo2.o
ld.bfd: warning: cannot find entry symbol _start; defaulting to 0000000000401000
[hjl@gnu-cfl-1 tmp]$ readelf -n a.out
Displaying notes found in: .note.gnu.property
Owner Data size Description
GNU 0x00000020 NT_GNU_PROPERTY_TYPE_0
Properties: x86 ISA used: SSE
x86 feature used: x86, XMM
[hjl@gnu-cfl-1 tmp]$
Can you tell me what the issues are?
--
H.J.