aboutsummaryrefslogtreecommitdiff
path: root/sysdeps
diff options
context:
space:
mode:
authorAdhemerval Zanella Netto <adhemerval.zanella@linaro.org>2023-03-23 10:13:51 -0300
committerAdhemerval Zanella <adhemerval.zanella@linaro.org>2023-03-29 14:33:06 -0300
commit33237fe83d553dff111915024c9670adc3f06048 (patch)
tree610ddd2195dca3c3901cfcc74f76e4ab6eb6c0e7 /sysdeps
parent6384171fa0cef59b738ce8d0499fcea4f5009411 (diff)
downloadglibc-33237fe83d553dff111915024c9670adc3f06048.zip
glibc-33237fe83d553dff111915024c9670adc3f06048.tar.gz
glibc-33237fe83d553dff111915024c9670adc3f06048.tar.bz2
Remove --enable-tunables configure option
And make always supported. The configure option was added on glibc 2.25 and some features require it (such as hwcap mask, huge pages support, and lock elisition tuning). It also simplifies the build permutations. Changes from v1: * Remove glibc.rtld.dynamic_sort changes, it is orthogonal and needs more discussion. * Cleanup more code. Reviewed-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
Diffstat (limited to 'sysdeps')
-rw-r--r--sysdeps/generic/ldsodefs.h20
-rw-r--r--sysdeps/generic/unsecvars.h8
-rw-r--r--sysdeps/nptl/dl-tls_init_tp.c2
-rw-r--r--sysdeps/nptl/pthreadP.h4
-rw-r--r--sysdeps/nptl/pthread_early_init.h2
-rw-r--r--sysdeps/nptl/pthread_mutex_conf.h8
-rw-r--r--sysdeps/powerpc/cpu-features.c9
-rw-r--r--sysdeps/s390/cpu-features.c14
-rw-r--r--sysdeps/sparc/sparc32/dl-machine.h5
-rw-r--r--sysdeps/unix/sysv/linux/Makefile4
-rw-r--r--sysdeps/unix/sysv/linux/aarch64/cpu-features.c6
-rw-r--r--sysdeps/unix/sysv/linux/powerpc/elision-conf.c8
-rw-r--r--sysdeps/unix/sysv/linux/s390/elision-conf.c8
-rw-r--r--sysdeps/unix/sysv/linux/x86/elision-conf.c8
-rw-r--r--sysdeps/unix/sysv/linux/x86_64/64/Makefile2
-rw-r--r--sysdeps/x86/Makefile10
-rw-r--r--sysdeps/x86/cacheinfo.h8
-rw-r--r--sysdeps/x86/cpu-features.c24
-rw-r--r--sysdeps/x86/cpu-tunables.c45
-rw-r--r--sysdeps/x86/dl-cacheinfo.h10
-rw-r--r--sysdeps/x86_64/Makefile2
21 files changed, 45 insertions, 162 deletions
diff --git a/sysdeps/generic/ldsodefs.h b/sysdeps/generic/ldsodefs.h
index c99dad7..e1ab272 100644
--- a/sysdeps/generic/ldsodefs.h
+++ b/sysdeps/generic/ldsodefs.h
@@ -586,11 +586,6 @@ struct rtld_global_ro
/* Mask for hardware capabilities that are available. */
EXTERN uint64_t _dl_hwcap;
-#if !HAVE_TUNABLES
- /* Mask for important hardware capabilities we honour. */
- EXTERN uint64_t _dl_hwcap_mask;
-#endif
-
#ifdef HAVE_AUX_VECTOR
/* Pointer to the auxv list supplied to the program at startup. */
EXTERN ElfW(auxv_t) *_dl_auxv;
@@ -1192,22 +1187,13 @@ extern struct link_map * _dl_get_dl_main_map (void)
brk. */
void *_dl_early_allocate (size_t size) attribute_hidden;
-/* Initialize the DSO sort algorithm to use. */
-#if !HAVE_TUNABLES
-static inline void
-__always_inline
-_dl_sort_maps_init (void)
-{
- /* This is optimized out if tunables are not enabled. */
-}
-#else
-extern void _dl_sort_maps_init (void) attribute_hidden;
-#endif
-
/* Initialization of libpthread for statically linked applications.
If libpthread is not linked in, this is an empty function. */
void __pthread_initialize_minimal (void) weak_function;
+/* Initialize the DSO sort algorithm to use. */
+extern void _dl_sort_maps_init (void) attribute_hidden;
+
/* Allocate memory for static TLS block (unless MEM is nonzero) and dtv. */
extern void *_dl_allocate_tls (void *mem);
rtld_hidden_proto (_dl_allocate_tls)
diff --git a/sysdeps/generic/unsecvars.h b/sysdeps/generic/unsecvars.h
index b50331b..81397fb 100644
--- a/sysdeps/generic/unsecvars.h
+++ b/sysdeps/generic/unsecvars.h
@@ -1,16 +1,10 @@
-#if !HAVE_TUNABLES
-# define GLIBC_TUNABLES_ENVVAR "GLIBC_TUNABLES\0"
-#else
-# define GLIBC_TUNABLES_ENVVAR
-#endif
-
/* Environment variable to be removed for SUID programs. The names are
all stuffed in a single string which means they have to be terminated
with a '\0' explicitly. */
#define UNSECURE_ENVVARS \
"GCONV_PATH\0" \
"GETCONF_DIR\0" \
- GLIBC_TUNABLES_ENVVAR \
+ "GLIBC_TUNABLES\0" \
"HOSTALIASES\0" \
"LD_AUDIT\0" \
"LD_DEBUG\0" \
diff --git a/sysdeps/nptl/dl-tls_init_tp.c b/sysdeps/nptl/dl-tls_init_tp.c
index 0db0349..50dc778 100644
--- a/sysdeps/nptl/dl-tls_init_tp.c
+++ b/sysdeps/nptl/dl-tls_init_tp.c
@@ -102,9 +102,7 @@ __tls_init_tp (void)
{
bool do_rseq = true;
-#if HAVE_TUNABLES
do_rseq = TUNABLE_GET (rseq, int, NULL);
-#endif
if (rseq_register_current_thread (pd, do_rseq))
{
/* We need a writable view of the variables. They are in
diff --git a/sysdeps/nptl/pthreadP.h b/sysdeps/nptl/pthreadP.h
index 536b75b..54f9198 100644
--- a/sysdeps/nptl/pthreadP.h
+++ b/sysdeps/nptl/pthreadP.h
@@ -45,11 +45,7 @@
static inline short max_adaptive_count (void)
{
-#if HAVE_TUNABLES
return __mutex_aconf.spin_count;
-#else
- return DEFAULT_ADAPTIVE_COUNT;
-#endif
}
diff --git a/sysdeps/nptl/pthread_early_init.h b/sysdeps/nptl/pthread_early_init.h
index 39255d9..f1a3b65 100644
--- a/sysdeps/nptl/pthread_early_init.h
+++ b/sysdeps/nptl/pthread_early_init.h
@@ -53,9 +53,7 @@ __pthread_early_init (void)
__default_pthread_attr.internal.stacksize = limit.rlim_cur;
__default_pthread_attr.internal.guardsize = GLRO (dl_pagesize);
-#if HAVE_TUNABLES
__pthread_tunables_init ();
-#endif
}
#endif /* _PTHREAD_EARLY_INIT_H */
diff --git a/sysdeps/nptl/pthread_mutex_conf.h b/sysdeps/nptl/pthread_mutex_conf.h
index 6d4b6ad..8151baf 100644
--- a/sysdeps/nptl/pthread_mutex_conf.h
+++ b/sysdeps/nptl/pthread_mutex_conf.h
@@ -20,7 +20,6 @@
#include <adaptive_spin_count.h>
-#if HAVE_TUNABLES
struct mutex_config
{
int spin_count;
@@ -30,12 +29,5 @@ extern struct mutex_config __mutex_aconf;
libc_hidden_proto (__mutex_aconf)
extern void __pthread_tunables_init (void) attribute_hidden;
-#else
-static inline void
-__pthread_tunables_init (void)
-{
- /* No tunables to initialize. */
-}
-#endif
#endif
diff --git a/sysdeps/powerpc/cpu-features.c b/sysdeps/powerpc/cpu-features.c
index 9ed0e5e..0ef3cf8 100644
--- a/sysdeps/powerpc/cpu-features.c
+++ b/sysdeps/powerpc/cpu-features.c
@@ -18,10 +18,7 @@
#include <stdint.h>
#include <cpu-features.h>
-
-#if HAVE_TUNABLES
-# include <elf/dl-tunables.h>
-#endif
+#include <elf/dl-tunables.h>
static inline void
init_cpu_features (struct cpu_features *cpu_features)
@@ -29,11 +26,7 @@ init_cpu_features (struct cpu_features *cpu_features)
/* Default is to use aligned memory access on optimized function unless
tunables is enable, since for this case user can explicit disable
unaligned optimizations. */
-#if HAVE_TUNABLES
int32_t cached_memfunc = TUNABLE_GET (glibc, cpu, cached_memopt, int32_t,
NULL);
cpu_features->use_cached_memopt = (cached_memfunc > 0);
-#else
- cpu_features->use_cached_memopt = false;
-#endif
}
diff --git a/sysdeps/s390/cpu-features.c b/sysdeps/s390/cpu-features.c
index afeb9b5..39f8c23 100644
--- a/sysdeps/s390/cpu-features.c
+++ b/sysdeps/s390/cpu-features.c
@@ -18,15 +18,12 @@
#include <cpu-features.h>
-#if HAVE_TUNABLES
-# include <elf/dl-tunables.h>
-# include <ifunc-memcmp.h>
-# include <string.h>
+#include <elf/dl-tunables.h>
+#include <ifunc-memcmp.h>
+#include <string.h>
extern __typeof (memcmp) MEMCMP_DEFAULT;
-#endif
-#if HAVE_TUNABLES
-# define S390_COPY_CPU_FEATURES(SRC_PTR, DEST_PTR) \
+#define S390_COPY_CPU_FEATURES(SRC_PTR, DEST_PTR) \
(DEST_PTR)->hwcap = (SRC_PTR)->hwcap; \
(DEST_PTR)->stfle_bits[0] = (SRC_PTR)->stfle_bits[0];
@@ -205,7 +202,6 @@ TUNABLE_CALLBACK (set_hwcaps) (tunable_val_t *valp)
cpu_features->stfle_bits[0] = cpu_features_curr.stfle_bits[0]
& cpu_features_orig.stfle_bits[0];
}
-#endif
static inline void
init_cpu_features (struct cpu_features *cpu_features)
@@ -233,7 +229,5 @@ init_cpu_features (struct cpu_features *cpu_features)
cpu_features->stfle_bits[0] = 0ULL;
}
-#if HAVE_TUNABLES
TUNABLE_GET (glibc, cpu, hwcaps, tunable_val_t *, TUNABLE_CALLBACK (set_hwcaps));
-#endif
}
diff --git a/sysdeps/sparc/sparc32/dl-machine.h b/sysdeps/sparc/sparc32/dl-machine.h
index 835e689..9b57ae1 100644
--- a/sysdeps/sparc/sparc32/dl-machine.h
+++ b/sysdeps/sparc/sparc32/dl-machine.h
@@ -39,8 +39,9 @@ elf_machine_matches_host (const Elf32_Ehdr *ehdr)
return 1;
else if (ehdr->e_machine == EM_SPARC32PLUS)
{
-#if HAVE_TUNABLES || defined SHARED
- uint64_t hwcap_mask = GET_HWCAP_MASK();
+#if defined SHARED
+ uint64_t hwcap_mask = TUNABLE_GET (glibc, cpu, hwcap_mask, uint64_t,
+ NULL);
return GLRO(dl_hwcap) & hwcap_mask & HWCAP_SPARC_V9;
#else
return GLRO(dl_hwcap) & HWCAP_SPARC_V9;
diff --git a/sysdeps/unix/sysv/linux/Makefile b/sysdeps/unix/sysv/linux/Makefile
index f8bd12d..b4323b2 100644
--- a/sysdeps/unix/sysv/linux/Makefile
+++ b/sysdeps/unix/sysv/linux/Makefile
@@ -245,11 +245,9 @@ tests-internal += \
tst-sigcontext-get_pc \
# tests-internal
-ifneq (no,$(have-tunables))
tests-internal += \
tst-rseq-disable \
- # tests-internal $(have-tunables)
-endif
+ # tests-internal
tests-time64 += \
tst-adjtimex-time64 \
diff --git a/sysdeps/unix/sysv/linux/aarch64/cpu-features.c b/sysdeps/unix/sysv/linux/aarch64/cpu-features.c
index 0380f11..dc09c1c 100644
--- a/sysdeps/unix/sysv/linux/aarch64/cpu-features.c
+++ b/sysdeps/unix/sysv/linux/aarch64/cpu-features.c
@@ -30,7 +30,6 @@
to see when pointer have been correctly tagged. */
#define MTE_ALLOWED_TAGS (0xfffe << PR_MTE_TAG_SHIFT)
-#if HAVE_TUNABLES
struct cpu_list
{
const char *name;
@@ -59,19 +58,16 @@ get_midr_from_mcpu (const char *mcpu)
return UINT64_MAX;
}
-#endif
static inline void
init_cpu_features (struct cpu_features *cpu_features)
{
register uint64_t midr = UINT64_MAX;
-#if HAVE_TUNABLES
/* Get the tunable override. */
const char *mcpu = TUNABLE_GET (glibc, cpu, name, const char *, NULL);
if (mcpu != NULL)
midr = get_midr_from_mcpu (mcpu);
-#endif
/* If there was no useful tunable override, query the MIDR if the kernel
allows it. */
@@ -100,13 +96,11 @@ init_cpu_features (struct cpu_features *cpu_features)
cpu_features->mte_state = 0;
#ifdef USE_MTAG
-# if HAVE_TUNABLES
int mte_state = TUNABLE_GET (glibc, mem, tagging, unsigned, 0);
cpu_features->mte_state = (GLRO (dl_hwcap2) & HWCAP2_MTE) ? mte_state : 0;
/* If we lack the MTE feature, disable the tunable, since it will
otherwise cause instructions that won't run on this CPU to be used. */
TUNABLE_SET (glibc, mem, tagging, cpu_features->mte_state);
-# endif
if (cpu_features->mte_state & 4)
/* Enable choosing system-preferred faulting mode. */
diff --git a/sysdeps/unix/sysv/linux/powerpc/elision-conf.c b/sysdeps/unix/sysv/linux/powerpc/elision-conf.c
index 8cd945a..7c98dbd 100644
--- a/sysdeps/unix/sysv/linux/powerpc/elision-conf.c
+++ b/sysdeps/unix/sysv/linux/powerpc/elision-conf.c
@@ -22,9 +22,7 @@
#include <unistd.h>
#include <dl-procinfo.h>
-#if HAVE_TUNABLES
-# define TUNABLE_NAMESPACE elision
-#endif
+#define TUNABLE_NAMESPACE elision
#include <elf/dl-tunables.h>
/* Reasonable initial tuning values, may be revised in the future.
@@ -51,7 +49,6 @@ struct elision_config __elision_aconf =
.skip_trylock_internal_abort = 3,
};
-#if HAVE_TUNABLES
static inline void
__always_inline
do_set_elision_enable (int32_t elision_enable)
@@ -94,14 +91,12 @@ TUNABLE_CALLBACK_FNDECL (skip_lock_internal_abort, int32_t);
TUNABLE_CALLBACK_FNDECL (skip_lock_out_of_tbegin_retries, int32_t);
TUNABLE_CALLBACK_FNDECL (try_tbegin, int32_t);
TUNABLE_CALLBACK_FNDECL (skip_trylock_internal_abort, int32_t);
-#endif
/* Initialize elision. */
void
__lll_elision_init (void)
{
-#if HAVE_TUNABLES
/* Elision depends on tunables and must be explicitly turned on by setting
the appropriate tunable on a supported platform. */
@@ -117,7 +112,6 @@ __lll_elision_init (void)
TUNABLE_CALLBACK (set_elision_try_tbegin));
TUNABLE_GET (skip_trylock_internal_abort, int32_t,
TUNABLE_CALLBACK (set_elision_skip_trylock_internal_abort));
-#endif
/* Linux from 3.9 through 4.2 do not abort HTM transaction on syscalls,
instead it suspends the transaction and resumes it when returning to
diff --git a/sysdeps/unix/sysv/linux/s390/elision-conf.c b/sysdeps/unix/sysv/linux/s390/elision-conf.c
index 5911e51..6a6d681 100644
--- a/sysdeps/unix/sysv/linux/s390/elision-conf.c
+++ b/sysdeps/unix/sysv/linux/s390/elision-conf.c
@@ -22,9 +22,7 @@
#include <unistd.h>
#include <dl-procinfo.h>
-#if HAVE_TUNABLES
-# define TUNABLE_NAMESPACE elision
-#endif
+#define TUNABLE_NAMESPACE elision
#include <elf/dl-tunables.h>
/* Reasonable initial tuning values, may be revised in the future.
@@ -51,7 +49,6 @@ struct elision_config __elision_aconf =
.skip_trylock_internal_abort = 3,
};
-#if HAVE_TUNABLES
static inline void
__always_inline
do_set_elision_enable (int32_t elision_enable)
@@ -93,14 +90,12 @@ TUNABLE_CALLBACK_FNDECL (skip_lock_internal_abort, int32_t);
TUNABLE_CALLBACK_FNDECL (skip_lock_out_of_tbegin_retries, int32_t);
TUNABLE_CALLBACK_FNDECL (try_tbegin, int32_t);
TUNABLE_CALLBACK_FNDECL (skip_trylock_internal_abort, int32_t);
-#endif
/* Initialize elison. */
void
__lll_elision_init (void)
{
-#if HAVE_TUNABLES
/* Elision depends on tunables and must be explicitly turned on by setting
the appropriate tunable on a supported platform. */
@@ -116,7 +111,6 @@ __lll_elision_init (void)
TUNABLE_CALLBACK (set_elision_try_tbegin));
TUNABLE_GET (skip_trylock_internal_abort, int32_t,
TUNABLE_CALLBACK (set_elision_skip_trylock_internal_abort));
-#endif
if (!__pthread_force_elision)
__elision_aconf.try_tbegin = 0; /* Disable elision on rwlocks. */
diff --git a/sysdeps/unix/sysv/linux/x86/elision-conf.c b/sysdeps/unix/sysv/linux/x86/elision-conf.c
index 6447bda..cfd9a71 100644
--- a/sysdeps/unix/sysv/linux/x86/elision-conf.c
+++ b/sysdeps/unix/sysv/linux/x86/elision-conf.c
@@ -22,9 +22,7 @@
#include <elision-conf.h>
#include <unistd.h>
-#if HAVE_TUNABLES
-# define TUNABLE_NAMESPACE elision
-#endif
+#define TUNABLE_NAMESPACE elision
#include <elf/dl-tunables.h>
/* Reasonable initial tuning values, may be revised in the future.
@@ -48,7 +46,6 @@ struct elision_config __elision_aconf =
.skip_trylock_internal_abort = 3,
};
-#if HAVE_TUNABLES
static __always_inline void
do_set_elision_enable (int32_t elision_enable)
{
@@ -87,14 +84,12 @@ TUNABLE_CALLBACK_FNDECL (skip_lock_busy, int32_t);
TUNABLE_CALLBACK_FNDECL (skip_lock_internal_abort, int32_t);
TUNABLE_CALLBACK_FNDECL (retry_try_xbegin, int32_t);
TUNABLE_CALLBACK_FNDECL (skip_trylock_internal_abort, int32_t);
-#endif
/* Initialize elision. */
void
__lll_elision_init (void)
{
-#if HAVE_TUNABLES
/* Elision depends on tunables and must be explicitly turned on by setting
the appropriate tunable on a supported platform. */
@@ -108,7 +103,6 @@ __lll_elision_init (void)
TUNABLE_CALLBACK (set_elision_retry_try_xbegin));
TUNABLE_GET (skip_trylock_internal_abort, int32_t,
TUNABLE_CALLBACK (set_elision_skip_trylock_internal_abort));
-#endif
if (!__pthread_force_elision)
__elision_aconf.retry_try_xbegin = 0; /* Disable elision on rwlocks. */
diff --git a/sysdeps/unix/sysv/linux/x86_64/64/Makefile b/sysdeps/unix/sysv/linux/x86_64/64/Makefile
index 8ff4f27..1bf7d52 100644
--- a/sysdeps/unix/sysv/linux/x86_64/64/Makefile
+++ b/sysdeps/unix/sysv/linux/x86_64/64/Makefile
@@ -2,7 +2,6 @@
default-abi := 64
ifeq ($(subdir),elf)
-ifneq ($(have-tunables),no)
tests-map-32bit = \
tst-map-32bit-1a \
@@ -24,4 +23,3 @@ tst-map-32bit-1b-ENV = GLIBC_TUNABLES=glibc.cpu.prefer_map_32bit_exec=1
$(objpfx)tst-map-32bit-1b: $(objpfx)tst-map-32bit-mod.so
endif
-endif
diff --git a/sysdeps/x86/Makefile b/sysdeps/x86/Makefile
index 56fd5fc..917c26f 100644
--- a/sysdeps/x86/Makefile
+++ b/sysdeps/x86/Makefile
@@ -25,7 +25,6 @@ tests-static += \
tst-ifunc-isa-1-static
test-xfail-tst-ifunc-isa-1 = $(with-lld)
test-xfail-tst-ifunc-isa-1-static = $(with-lld)
-ifneq ($(have-tunables),no)
tests += \
tst-ifunc-isa-2 \
tst-ifunc-isa-2-static
@@ -35,7 +34,6 @@ test-xfail-tst-ifunc-isa-2 = $(with-lld)
test-xfail-tst-ifunc-isa-2-static = $(with-lld)
endif
endif
-endif
ifeq (yes,$(enable-x86-isa-level))
tests += tst-isa-level-1
modules-names += tst-isa-level-mod-1-baseline \
@@ -65,11 +63,9 @@ $(objpfx)tst-isa-level-1.out: $(objpfx)tst-isa-level-mod-1-baseline.so \
$(objpfx)tst-isa-level-mod-1-v3.so \
$(objpfx)tst-isa-level-mod-1-v4.so
endif
-ifneq ($(have-tunables),no)
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)
endif
-endif
ifeq ($(subdir),math)
tests += tst-ldbl-nonnormal-printf
@@ -79,12 +75,10 @@ ifeq ($(subdir),setjmp)
gen-as-const-headers += jmp_buf-ssp.sym
sysdep_routines += __longjmp_cancel
ifneq ($(enable-cet),no)
-ifneq ($(have-tunables),no)
tests += tst-setjmp-cet
tst-setjmp-cet-ENV = GLIBC_TUNABLES=glibc.cpu.x86_ibt=on:glibc.cpu.x86_shstk=on
endif
endif
-endif
ifeq ($(subdir),string)
sysdep_routines += cacheinfo
@@ -135,10 +129,8 @@ tests += tst-cet-legacy-1 tst-cet-legacy-1a tst-cet-legacy-2 \
tst-cet-legacy-10 tst-cet-legacy-10-static
tests-static += tst-cet-legacy-9-static tst-cet-legacy-10-static
tst-cet-legacy-1a-ARGS = -- $(host-test-program-cmd)
-ifneq (no,$(have-tunables))
tests += tst-cet-legacy-4a tst-cet-legacy-4b tst-cet-legacy-4c \
tst-cet-legacy-5b tst-cet-legacy-6b
-endif
modules-names += tst-cet-legacy-mod-1 tst-cet-legacy-mod-2 \
tst-cet-legacy-mod-4 tst-cet-legacy-mod-5a \
tst-cet-legacy-mod-5b tst-cet-legacy-mod-5c \
@@ -195,7 +187,6 @@ $(objpfx)tst-cet-legacy-6a.out: $(objpfx)tst-cet-legacy-mod-6a.so \
$(objpfx)tst-cet-legacy-mod-6a.so: $(objpfx)tst-cet-legacy-mod-6c.so
$(objpfx)tst-cet-legacy-mod-6b.so: $(objpfx)tst-cet-legacy-mod-6c.so
LDFLAGS-tst-cet-legacy-mod-6c.so = -Wl,--enable-new-dtags,-z,nodelete
-ifneq (no,$(have-tunables))
$(objpfx)tst-cet-legacy-4a.out: $(objpfx)tst-cet-legacy-mod-4.so
tst-cet-legacy-4a-ENV = GLIBC_TUNABLES=glibc.cpu.x86_shstk=permissive
$(objpfx)tst-cet-legacy-4b.out: $(objpfx)tst-cet-legacy-mod-4.so
@@ -211,7 +202,6 @@ tst-cet-legacy-6b-ENV = GLIBC_TUNABLES=glibc.cpu.hwcaps=-IBT,-SHSTK
tst-cet-legacy-9-ENV = GLIBC_TUNABLES=glibc.cpu.hwcaps=-IBT,-SHSTK
tst-cet-legacy-9-static-ENV = GLIBC_TUNABLES=glibc.cpu.hwcaps=-IBT,-SHSTK
endif
-endif
# Add -fcf-protection to CFLAGS when CET is enabled.
CFLAGS-.o += -fcf-protection
diff --git a/sysdeps/x86/cacheinfo.h b/sysdeps/x86/cacheinfo.h
index 7a99e04..ec1bc14 100644
--- a/sysdeps/x86/cacheinfo.h
+++ b/sysdeps/x86/cacheinfo.h
@@ -21,11 +21,9 @@
#include <cpuid.h>
#include <cpu-features.h>
-#if HAVE_TUNABLES
-# define TUNABLE_NAMESPACE cpu
-# include <unistd.h> /* Get STDOUT_FILENO for _dl_printf. */
-# include <elf/dl-tunables.h>
-#endif
+#define TUNABLE_NAMESPACE cpu
+#include <unistd.h> /* Get STDOUT_FILENO for _dl_printf. */
+#include <elf/dl-tunables.h>
#if IS_IN (libc)
/* Data cache size for use in memory and string routines, typically
diff --git a/sysdeps/x86/cpu-features.c b/sysdeps/x86/cpu-features.c
index 822688e..978eb29 100644
--- a/sysdeps/x86/cpu-features.c
+++ b/sysdeps/x86/cpu-features.c
@@ -23,11 +23,10 @@
#include <dl-cacheinfo.h>
#include <dl-minsigstacksize.h>
-#if HAVE_TUNABLES
extern void TUNABLE_CALLBACK (set_hwcaps) (tunable_val_t *)
attribute_hidden;
-# ifdef __LP64__
+#ifdef __LP64__
static void
TUNABLE_CALLBACK (set_prefer_map_32bit_exec) (tunable_val_t *valp)
{
@@ -35,17 +34,14 @@ TUNABLE_CALLBACK (set_prefer_map_32bit_exec) (tunable_val_t *valp)
GLRO(dl_x86_cpu_features).preferred[index_arch_Prefer_MAP_32BIT_EXEC]
|= bit_arch_Prefer_MAP_32BIT_EXEC;
}
-# endif
+#endif
-# if CET_ENABLED
+#if CET_ENABLED
extern void TUNABLE_CALLBACK (set_x86_ibt) (tunable_val_t *)
attribute_hidden;
extern void TUNABLE_CALLBACK (set_x86_shstk) (tunable_val_t *)
attribute_hidden;
-# endif
-#endif
-#if CET_ENABLED
# include <dl-cet.h>
#endif
@@ -712,13 +708,12 @@ no_cpuid:
dl_init_cacheinfo (cpu_features);
-#if HAVE_TUNABLES
TUNABLE_GET (hwcaps, tunable_val_t *, TUNABLE_CALLBACK (set_hwcaps));
-# ifdef __LP64__
+#ifdef __LP64__
TUNABLE_GET (prefer_map_32bit_exec, tunable_val_t *,
TUNABLE_CALLBACK (set_prefer_map_32bit_exec));
-# endif
+#endif
bool disable_xsave_features = false;
@@ -774,13 +769,6 @@ no_cpuid:
CPU_FEATURE_UNSET (cpu_features, FMA4);
}
-#elif defined SHARED
- /* Reuse dl_platform, dl_hwcap and dl_hwcap_mask for x86. The
- glibc.cpu.hwcap_mask tunable is initialized already, so no
- need to do this. */
- GLRO(dl_hwcap_mask) = HWCAP_IMPORTANT;
-#endif
-
#ifdef __x86_64__
GLRO(dl_hwcap) = HWCAP_X86_64;
if (cpu_features->basic.kind == arch_kind_intel)
@@ -828,12 +816,10 @@ no_cpuid:
#endif
#if CET_ENABLED
-# if HAVE_TUNABLES
TUNABLE_GET (x86_ibt, tunable_val_t *,
TUNABLE_CALLBACK (set_x86_ibt));
TUNABLE_GET (x86_shstk, tunable_val_t *,
TUNABLE_CALLBACK (set_x86_shstk));
-# endif
/* Check CET status. */
unsigned int cet_status = get_cet_status ();
diff --git a/sysdeps/x86/cpu-tunables.c b/sysdeps/x86/cpu-tunables.c
index 772fb0c..0d4f328 100644
--- a/sysdeps/x86/cpu-tunables.c
+++ b/sysdeps/x86/cpu-tunables.c
@@ -16,31 +16,30 @@
License along with the GNU C Library; if not, see
<https://www.gnu.org/licenses/>. */
-#if HAVE_TUNABLES
-# define TUNABLE_NAMESPACE cpu
-# include <stdbool.h>
-# include <stdint.h>
-# include <unistd.h> /* Get STDOUT_FILENO for _dl_printf. */
-# include <elf/dl-tunables.h>
-# include <string.h>
-# include <cpu-features.h>
-# include <ldsodefs.h>
+#define TUNABLE_NAMESPACE cpu
+#include <stdbool.h>
+#include <stdint.h>
+#include <unistd.h> /* Get STDOUT_FILENO for _dl_printf. */
+#include <elf/dl-tunables.h>
+#include <string.h>
+#include <cpu-features.h>
+#include <ldsodefs.h>
/* We can't use IFUNC memcmp nor strlen in init_cpu_features from libc.a
since IFUNC must be set up by init_cpu_features. */
-# if defined USE_MULTIARCH && !defined SHARED
-# ifdef __x86_64__
+#if defined USE_MULTIARCH && !defined SHARED
+# ifdef __x86_64__
/* DEFAULT_MEMCMP by sysdeps/x86_64/memcmp-isa-default-impl.h. */
-# include <sysdeps/x86_64/memcmp-isa-default-impl.h>
-# else
-# define DEFAULT_MEMCMP __memcmp_ia32
-# endif
-extern __typeof (memcmp) DEFAULT_MEMCMP;
+# include <sysdeps/x86_64/memcmp-isa-default-impl.h>
# else
-# define DEFAULT_MEMCMP memcmp
+# define DEFAULT_MEMCMP __memcmp_ia32
# endif
+extern __typeof (memcmp) DEFAULT_MEMCMP;
+#else
+# define DEFAULT_MEMCMP memcmp
+#endif
-# define CHECK_GLIBC_IFUNC_CPU_OFF(f, cpu_features, name, len) \
+#define CHECK_GLIBC_IFUNC_CPU_OFF(f, cpu_features, name, len) \
_Static_assert (sizeof (#name) - 1 == len, #name " != " #len); \
if (!DEFAULT_MEMCMP (f, #name, len)) \
{ \
@@ -50,7 +49,7 @@ extern __typeof (memcmp) DEFAULT_MEMCMP;
/* Disable a preferred feature NAME. We don't enable a preferred feature
which isn't available. */
-# define CHECK_GLIBC_IFUNC_PREFERRED_OFF(f, cpu_features, name, len) \
+#define CHECK_GLIBC_IFUNC_PREFERRED_OFF(f, cpu_features, name, len) \
_Static_assert (sizeof (#name) - 1 == len, #name " != " #len); \
if (!DEFAULT_MEMCMP (f, #name, len)) \
{ \
@@ -60,7 +59,7 @@ extern __typeof (memcmp) DEFAULT_MEMCMP;
}
/* Enable/disable a preferred feature NAME. */
-# define CHECK_GLIBC_IFUNC_PREFERRED_BOTH(f, cpu_features, name, \
+#define CHECK_GLIBC_IFUNC_PREFERRED_BOTH(f, cpu_features, name, \
disable, len) \
_Static_assert (sizeof (#name) - 1 == len, #name " != " #len); \
if (!DEFAULT_MEMCMP (f, #name, len)) \
@@ -74,7 +73,7 @@ extern __typeof (memcmp) DEFAULT_MEMCMP;
/* Enable/disable a preferred feature NAME. Enable a preferred feature
only if the feature NEED is usable. */
-# define CHECK_GLIBC_IFUNC_PREFERRED_NEED_BOTH(f, cpu_features, name, \
+#define CHECK_GLIBC_IFUNC_PREFERRED_NEED_BOTH(f, cpu_features, name, \
need, disable, len) \
_Static_assert (sizeof (#name) - 1 == len, #name " != " #len); \
if (!DEFAULT_MEMCMP (f, #name, len)) \
@@ -286,8 +285,7 @@ TUNABLE_CALLBACK (set_hwcaps) (tunable_val_t *valp)
while (*c != '\0');
}
-# if CET_ENABLED
-
+#if CET_ENABLED
attribute_hidden
void
TUNABLE_CALLBACK (set_x86_ibt) (tunable_val_t *valp)
@@ -313,5 +311,4 @@ TUNABLE_CALLBACK (set_x86_shstk) (tunable_val_t *valp)
sizeof ("permissive")) == 0)
GL(dl_x86_feature_control).shstk = cet_permissive;
}
-# endif
#endif
diff --git a/sysdeps/x86/dl-cacheinfo.h b/sysdeps/x86/dl-cacheinfo.h
index a0474af..ab67148 100644
--- a/sysdeps/x86/dl-cacheinfo.h
+++ b/sysdeps/x86/dl-cacheinfo.h
@@ -760,10 +760,8 @@ dl_init_cacheinfo (struct cpu_features *cpu_features)
else if (non_temporal_threshold > maximum_non_temporal_threshold)
non_temporal_threshold = maximum_non_temporal_threshold;
-#if HAVE_TUNABLES
/* NB: The REP MOVSB threshold must be greater than VEC_SIZE * 8. */
unsigned int minimum_rep_movsb_threshold;
-#endif
/* NB: The default REP MOVSB threshold is 4096 * (VEC_SIZE / 16) for
VEC_SIZE == 64 or 32. For VEC_SIZE == 16, the default REP MOVSB
threshold is 2048 * (VEC_SIZE / 16). */
@@ -772,24 +770,18 @@ dl_init_cacheinfo (struct cpu_features *cpu_features)
&& !CPU_FEATURE_PREFERRED_P (cpu_features, Prefer_No_AVX512))
{
rep_movsb_threshold = 4096 * (64 / 16);
-#if HAVE_TUNABLES
minimum_rep_movsb_threshold = 64 * 8;
-#endif
}
else if (CPU_FEATURE_PREFERRED_P (cpu_features,
AVX_Fast_Unaligned_Load))
{
rep_movsb_threshold = 4096 * (32 / 16);
-#if HAVE_TUNABLES
minimum_rep_movsb_threshold = 32 * 8;
-#endif
}
else
{
rep_movsb_threshold = 2048 * (16 / 16);
-#if HAVE_TUNABLES
minimum_rep_movsb_threshold = 16 * 8;
-#endif
}
/* NB: The default REP MOVSB threshold is 2112 on processors with fast
short REP MOVSB (FSRM). */
@@ -799,7 +791,6 @@ dl_init_cacheinfo (struct cpu_features *cpu_features)
/* The default threshold to use Enhanced REP STOSB. */
unsigned long int rep_stosb_threshold = 2048;
-#if HAVE_TUNABLES
long int tunable_size;
tunable_size = TUNABLE_GET (x86_data_cache_size, long int, NULL);
@@ -836,7 +827,6 @@ dl_init_cacheinfo (struct cpu_features *cpu_features)
minimum_rep_movsb_threshold, SIZE_MAX);
TUNABLE_SET_WITH_BOUNDS (x86_rep_stosb_threshold, rep_stosb_threshold, 1,
SIZE_MAX);
-#endif
unsigned long int rep_movsb_stop_threshold;
/* ERMS feature is implemented from AMD Zen3 architecture and it is
diff --git a/sysdeps/x86_64/Makefile b/sysdeps/x86_64/Makefile
index 688eb2d..54396c3 100644
--- a/sysdeps/x86_64/Makefile
+++ b/sysdeps/x86_64/Makefile
@@ -57,7 +57,6 @@ $(objpfx)tst-quad2pie: $(objpfx)tst-quadmod2pie.o
CFLAGS-tst-quad1pie.c = $(PIE-ccflag)
CFLAGS-tst-quad2pie.c = $(PIE-ccflag)
-ifneq (no,$(have-tunables))
tests += tst-platform-1
modules-names += tst-platformmod-1 x86_64/tst-platformmod-2
extra-test-objs += tst-platformmod-2.o
@@ -71,7 +70,6 @@ $(objpfx)tst-platform-1.out: $(objpfx)x86_64/tst-platformmod-2.so
# always set to x86_64.
tst-platform-1-ENV = LD_PRELOAD=$(objpfx)\$$PLATFORM/tst-platformmod-2.so \
GLIBC_TUNABLES=glibc.cpu.hwcaps=-AVX512F,-AVX2
-endif
tests += tst-audit3 tst-audit4 tst-audit5 tst-audit6 tst-audit7 \
tst-audit10 tst-sse tst-avx tst-avx512