public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
* V5 [PATCH 0/2] x86: Support GNU_PROPERTY_X86_ISA_1_NEEDED marker [BZ #26717]
@ 2020-12-06 14:49 H.J. Lu
  2020-12-06 14:49 ` V5 [PATCH 1/2] x86: Support GNU_PROPERTY_X86_ISA_1_V[234] " H.J. Lu
  2020-12-06 14:49 ` V5 [PATCH 2/2] ldconfig/x86: Add ISA level check to glibc-hwcaps H.J. Lu
  0 siblings, 2 replies; 27+ messages in thread
From: H.J. Lu @ 2020-12-06 14:49 UTC (permalink / raw)
  To: libc-alpha; +Cc: Florian Weimer

GCC 11 supports -march=x86-64-v[234] to enable x86 micro-architecture ISA
levels and -mneeded to emit GNU_PROPERTY_X86_ISA_1_NEEDED property with
GNU_PROPERTY_X86_ISA_1_V[234] marker.

GNU_PROPERTY_X86_ISA_1_NEEDED property in x86 ELF binaries indicate the
micro-architecture ISA level required to execute the binary.  The marker
must be added by programmers explicitly in one of 3 ways:

1. Pass -mneeded to GCC.
2. Add the marker in the linker inputs as this patch does.
3. Pass -z x86-64-v[234] to the linker.

Marked elf/tst-isa-level-1 with x86-64-v4, ran it on x86-64-v3 machine
and got:

[hjl@gnu-cfl-2 build-x86_64-linux]$ ./elf/tst-isa-level-1
./elf/tst-isa-level-1: CPU ISA level is lower than required
[hjl@gnu-cfl-2 build-x86_64-linux]$

H.J. Lu (2):
  x86: Support GNU_PROPERTY_X86_ISA_1_V[234] marker [BZ #26717]
  ldconfig/x86: Add ISA level check to glibc-hwcaps

 config.h.in                                   |   3 +
 elf/elf.h                                     |  35 +++---
 elf/ldconfig.c                                |   9 +-
 elf/readelflib.c                              |  83 ++++++++++++-
 elf/readlib.c                                 |   7 +-
 elf/tst-glibc-hwcaps-2-cache.c                |  45 +++++++
 .../etc/ld.so.conf                            |   2 +
 .../postclean.req                             |   0
 elf/tst-glibc-hwcaps-2-cache.script           |   6 +
 sysdeps/generic/ldconfig.h                    |   9 +-
 sysdeps/generic/read-prop.h                   |  32 +++++
 sysdeps/unix/sysv/linux/x86/read-prop.h       |  57 +++++++++
 sysdeps/unix/sysv/linux/x86/readelflib.c      |  67 +++++++++--
 sysdeps/unix/sysv/linux/x86_64/Makefile       |  26 ++++
 .../sysv/linux/x86_64/tst-glibc-hwcaps-2.c    |  50 ++++++++
 .../linux/x86_64/x86-64-isa-level-VALUE.c     |   4 +
 sysdeps/x86/Makefile                          |  10 ++
 sysdeps/x86/abi-note.c                        |  29 +++++
 sysdeps/x86/configure                         | 101 ++++++++++++++++
 sysdeps/x86/configure.ac                      |  26 ++++
 sysdeps/x86/cpu-features.c                    |   3 +
 sysdeps/x86/dl-cet.c                          |  12 +-
 sysdeps/x86/dl-prop.h                         | 113 +++++++++++++-----
 sysdeps/x86/get-isa-level.h                   |  66 ++++++++++
 sysdeps/x86/include/cpu-features.h            |   2 +
 sysdeps/x86/isa-level.c                       |  95 +++++++++++++++
 sysdeps/x86/link_map.h                        |  18 +--
 sysdeps/x86/tst-isa-level-1.c                 |  74 ++++++++++++
 sysdeps/x86/tst-isa-level-mod-1.c             |  23 ++++
 sysdeps/x86/tst-isa-level-mod-1a.c            |   2 +
 sysdeps/x86/tst-isa-level-mod-1b.c            |   1 +
 sysdeps/x86_64/dl-hwcaps-subdirs.c            |  30 ++---
 sysdeps/x86_64/tst-glibc-hwcaps.c             |  41 ++-----
 33 files changed, 950 insertions(+), 131 deletions(-)
 create mode 100644 elf/tst-glibc-hwcaps-2-cache.c
 create mode 100644 elf/tst-glibc-hwcaps-2-cache.root/etc/ld.so.conf
 create mode 100644 elf/tst-glibc-hwcaps-2-cache.root/postclean.req
 create mode 100644 elf/tst-glibc-hwcaps-2-cache.script
 create mode 100644 sysdeps/generic/read-prop.h
 create mode 100644 sysdeps/unix/sysv/linux/x86/read-prop.h
 create mode 100644 sysdeps/unix/sysv/linux/x86_64/tst-glibc-hwcaps-2.c
 create mode 100644 sysdeps/unix/sysv/linux/x86_64/x86-64-isa-level-VALUE.c
 create mode 100644 sysdeps/x86/abi-note.c
 create mode 100644 sysdeps/x86/get-isa-level.h
 create mode 100644 sysdeps/x86/isa-level.c
 create mode 100644 sysdeps/x86/tst-isa-level-1.c
 create mode 100644 sysdeps/x86/tst-isa-level-mod-1.c
 create mode 100644 sysdeps/x86/tst-isa-level-mod-1a.c
 create mode 100644 sysdeps/x86/tst-isa-level-mod-1b.c

-- 
2.28.0


^ permalink raw reply	[flat|nested] 27+ messages in thread

end of thread, other threads:[~2021-01-29 12:45 UTC | newest]

Thread overview: 27+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-06 14:49 V5 [PATCH 0/2] x86: Support GNU_PROPERTY_X86_ISA_1_NEEDED marker [BZ #26717] H.J. Lu
2020-12-06 14:49 ` V5 [PATCH 1/2] x86: Support GNU_PROPERTY_X86_ISA_1_V[234] " H.J. Lu
2021-01-06 12:00   ` Adhemerval Zanella
2021-01-06 17:11     ` V6 " H.J. Lu
2021-01-07 20:09       ` Adhemerval Zanella
2021-01-07 20:58         ` H.J. Lu
2021-01-18 11:17           ` Florian Weimer
2021-01-18 13:49             ` H.J. Lu
2021-01-18 15:15               ` Florian Weimer
2020-12-06 14:49 ` V5 [PATCH 2/2] ldconfig/x86: Add ISA level check to glibc-hwcaps H.J. Lu
2020-12-07 10:00   ` Florian Weimer
2020-12-08 13:25     ` H.J. Lu
2020-12-08 13:31       ` Florian Weimer
2020-12-08 14:10         ` H.J. Lu
2020-12-08 14:18           ` Florian Weimer
2020-12-08 14:23             ` H.J. Lu
2020-12-08 15:15               ` Florian Weimer
2020-12-08 15:31                 ` H.J. Lu
2020-12-09  3:27                   ` [PATCH] ldconfig/x86: Store ISA level in cache and aux cache H.J. Lu
2021-01-12 16:25                     ` Adhemerval Zanella
2021-01-12 23:32                       ` V2 " H.J. Lu
2021-01-13 13:47                         ` Adhemerval Zanella
2021-01-13 14:12                           ` H.J. Lu
2021-01-28 20:20                     ` Florian Weimer
2021-01-28 20:43                       ` H.J. Lu
2021-01-29  8:56                         ` Florian Weimer
2021-01-29 12:44                           ` H.J. Lu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).