aboutsummaryrefslogtreecommitdiff
path: root/sysdeps/unix/sysv/linux/x86_64/Makefile
diff options
context:
space:
mode:
authorH.J. Lu <hjl.tools@gmail.com>2020-12-05 07:01:58 -0800
committerH.J. Lu <hjl.tools@gmail.com>2021-01-13 05:51:17 -0800
commitefbbd9c33adfa843d65860b1b02adebb8ecb57ce (patch)
tree79c61c55698036fc99ec936ea400c7a9975eef28 /sysdeps/unix/sysv/linux/x86_64/Makefile
parent86a4d3fa7d1bda3c02cf713cf289d6f893970117 (diff)
downloadglibc-efbbd9c33adfa843d65860b1b02adebb8ecb57ce.zip
glibc-efbbd9c33adfa843d65860b1b02adebb8ecb57ce.tar.gz
glibc-efbbd9c33adfa843d65860b1b02adebb8ecb57ce.tar.bz2
ldconfig/x86: Store ISA level in cache and aux cache
Store ISA level in the portion of the unused upper 32 bits of the hwcaps field in cache and the unused pad field in aux cache. ISA level is stored and checked only for shared objects in glibc-hwcaps subdirectories. The shared objects in the default directories aren't checked since there are no fallbacks for these shared objects. Tested on x86-64-v2, x86-64-v3 and x86-64-v4 machines with --disable-hardcoded-path-in-tests and --enable-hardcoded-path-in-tests.
Diffstat (limited to 'sysdeps/unix/sysv/linux/x86_64/Makefile')
-rw-r--r--sysdeps/unix/sysv/linux/x86_64/Makefile51
1 files changed, 51 insertions, 0 deletions
diff --git a/sysdeps/unix/sysv/linux/x86_64/Makefile b/sysdeps/unix/sysv/linux/x86_64/Makefile
index 9b82155..5e19202 100644
--- a/sysdeps/unix/sysv/linux/x86_64/Makefile
+++ b/sysdeps/unix/sysv/linux/x86_64/Makefile
@@ -13,3 +13,54 @@ endif
ifeq ($(subdir),misc)
gen-as-const-headers += sigaltstack-offsets.sym
endif
+
+ifeq ($(subdir),elf)
+ifeq (yes,$(enable-x86-isa-level))
+tests += \
+ tst-glibc-hwcaps-2
+ifeq (no,$(build-hardcoded-path-in-tests))
+# This is an ld.so.cache test, and RPATH/RUNPATH in the executable
+# interferes with its test objectives.
+tests-container += \
+ tst-glibc-hwcaps-2-cache
+endif
+modules-names += \
+ libx86-64-isa-level-1 \
+ libx86-64-isa-level-2 \
+ libx86-64-isa-level-3 \
+ libx86-64-isa-level-4
+
+$(objpfx)tst-glibc-hwcaps-2: $(objpfx)libx86-64-isa-level.so
+
+$(objpfx)tst-glibc-hwcaps-2.out: \
+ $(objpfx)glibc-hwcaps/x86-64-v2/libx86-64-isa-level.so \
+ $(objpfx)glibc-hwcaps/x86-64-v4/libx86-64-isa-level.so \
+ $(objpfx)glibc-hwcaps/x86-64-v3/libx86-64-isa-level.so
+$(objpfx)glibc-hwcaps/x86-64-v2/libx86-64-isa-level.so: \
+ $(objpfx)libx86-64-isa-level-2.so
+ $(make-target-directory)
+ cp $< $@
+$(objpfx)glibc-hwcaps/x86-64-v3/libx86-64-isa-level.so: \
+ $(objpfx)libx86-64-isa-level-3.so
+ $(make-target-directory)
+ cp $< $@
+$(objpfx)glibc-hwcaps/x86-64-v4/libx86-64-isa-level.so: \
+ $(objpfx)libx86-64-isa-level-4.so
+ $(make-target-directory)
+ cp $< $@
+
+CFLAGS-libx86-64-isa-level-1.os += -march=x86-64
+CFLAGS-libx86-64-isa-level-2.os += -march=x86-64
+CFLAGS-libx86-64-isa-level-3.os += -march=x86-64
+CFLAGS-libx86-64-isa-level-4.os += -march=x86-64
+
+# The test modules are parameterized by preprocessor macros.
+LDFLAGS-libx86-64-isa-level-1.so += -Wl,-soname,libx86-64-isa-level.so
+LDFLAGS-libx86-64-isa-level-4.so += -Wl,-soname,libx86-64-isa-level.so
+$(objpfx)libx86-64-isa-level%.os: $(..)/sysdeps/unix/sysv/linux/x86_64/x86-64-isa-level-VALUE.c
+ $(compile-command.c) -DVALUE=$(lastword $(subst -, ,$*)) \
+ -DISA_LEVEL="(1 << ($(lastword $(subst -, ,$*)) - 1))"
+$(objpfx)libx86-64-isa-level.so: $(objpfx)libx86-64-isa-level-1.so
+ cp $< $@
+endif
+endif # $(subdir) == elf