This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


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.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]