diff options
author | Adhemerval Zanella <adhemerval.zanella@linaro.org> | 2023-12-06 10:24:01 -0300 |
---|---|---|
committer | Adhemerval Zanella <adhemerval.zanella@linaro.org> | 2023-12-19 13:25:45 -0300 |
commit | 2a969b53c0b02fed7e43473a92f219d737fd217a (patch) | |
tree | b55eda5dc496c260e9757a5fc3856838d85b38fd /sysdeps/x86/Makefile | |
parent | 5275fc784c8113c84c85ca028ce621f68fe6642b (diff) | |
download | glibc-2a969b53c0b02fed7e43473a92f219d737fd217a.tar.gz glibc-2a969b53c0b02fed7e43473a92f219d737fd217a.tar.xz glibc-2a969b53c0b02fed7e43473a92f219d737fd217a.zip |
elf: Do not duplicate the GLIBC_TUNABLES string
The tunable parsing duplicates the tunable environment variable so it null-terminates each one since it simplifies the later parsing. It has the drawback of adding another point of failure (__minimal_malloc failing), and the memory copy requires tuning the compiler to avoid mem operations calls. The parsing now tracks the tunable start and its size. The dl-tunable-parse.h adds helper functions to help parsing, like a strcmp that also checks for size and an iterator for suboptions that are comma-separated (used on hwcap parsing by x86, powerpc, and s390x). Since the environment variable is allocated on the stack by the kernel, it is safe to keep the references to the suboptions for later parsing of string tunables (as done by set_hwcaps by multiple architectures). Checked on x86_64-linux-gnu, powerpc64le-linux-gnu, and aarch64-linux-gnu. Reviewed-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
Diffstat (limited to 'sysdeps/x86/Makefile')
-rw-r--r-- | sysdeps/x86/Makefile | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/sysdeps/x86/Makefile b/sysdeps/x86/Makefile index 6911a07a87..0aafd2afeb 100644 --- a/sysdeps/x86/Makefile +++ b/sysdeps/x86/Makefile @@ -17,6 +17,7 @@ tests += \ tst-cpu-features-cpuinfo-static \ tst-cpu-features-supports \ tst-cpu-features-supports-static \ + tst-hwcap-tunables \ # tests tests-static += \ tst-get-cpu-features-static \ @@ -80,6 +81,7 @@ $(objpfx)tst-isa-level-1.out: $(objpfx)tst-isa-level-mod-1-baseline.so \ endif tst-ifunc-isa-2-ENV = GLIBC_TUNABLES=glibc.cpu.hwcaps=-SSE4_2,-AVX,-AVX2,-AVX512F tst-ifunc-isa-2-static-ENV = $(tst-ifunc-isa-2-ENV) +tst-hwcap-tunables-ARGS = -- $(host-test-program-cmd) endif ifeq ($(subdir),math) |