about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--INSTALL19
-rw-r--r--Makeconfig9
-rw-r--r--NEWS3
-rw-r--r--config.h.in3
-rw-r--r--config.make.in1
-rwxr-xr-xconfigure17
-rw-r--r--configure.ac10
-rw-r--r--elf/Makefile9
-rw-r--r--elf/dl-cache.c2
-rw-r--r--elf/dl-hwcaps.h11
-rw-r--r--elf/dl-sort-maps.c7
-rw-r--r--elf/dl-support.c15
-rw-r--r--elf/dl-tls.c6
-rw-r--r--elf/dl-tunables.c12
-rw-r--r--elf/dl-tunables.h35
-rw-r--r--elf/dl-usage.c8
-rw-r--r--elf/rtld.c23
-rw-r--r--elf/tst-env-setuid-tunables.c11
-rw-r--r--gmon/gmon.c12
-rw-r--r--malloc/Makefile2
-rw-r--r--malloc/arena.c118
-rw-r--r--malloc/malloc-check.c8
-rw-r--r--malloc/malloc.c14
-rw-r--r--manual/install.texi19
-rw-r--r--nptl/pthread_mutex_conf.c4
-rw-r--r--nptl/tst-mutex8.c2
-rwxr-xr-xscripts/build-many-glibcs.py1
-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
48 files changed, 75 insertions, 513 deletions
diff --git a/INSTALL b/INSTALL
index 32535709d9..b406a11268 100644
--- a/INSTALL
+++ b/INSTALL
@@ -228,25 +228,6 @@ if 'CFLAGS' is specified it must enable optimization.  For example:
      By default for x86_64, the GNU C Library is built with the vector
      math library.  Use this option to disable the vector math library.
 
-'--enable-tunables'
-     Tunables support allows additional library parameters to be
-     customized at runtime.  This feature is enabled by default.  This
-     option can take the following values:
-
-     'yes'
-          This is the default if no option is passed to configure.  This
-          enables tunables and selects the default frontend (currently
-          'valstring').
-
-     'no'
-          This option disables tunables.
-
-     'valstring'
-          This enables tunables and selects the 'valstring' frontend for
-          tunables.  This frontend allows users to specify tunables as a
-          colon-separated list in a single environment variable
-          'GLIBC_TUNABLES'.
-
 '--disable-crypt'
      Do not install the passphrase-hashing library 'libcrypt' or the
      header file 'crypt.h'.  'unistd.h' will still declare the function
diff --git a/Makeconfig b/Makeconfig
index 2fda4af5f7..2514db35f6 100644
--- a/Makeconfig
+++ b/Makeconfig
@@ -1017,11 +1017,8 @@ CPPFLAGS = $(config-extra-cppflags) $(CPPUNDEFS) $(CPPFLAGS-config) \
 	   $(CPPFLAGS-$(suffix $@)) \
 	   $(foreach lib,$(libof-$(basename $(@F))) \
 			 $(libof-$(<F)) $(libof-$(@F)),$(CPPFLAGS-$(lib))) \
-	   $(CPPFLAGS-$(<F)) $(CPPFLAGS-$(@F)) $(CPPFLAGS-$(basename $(@F)))
-
-ifneq (no,$(have-tunables))
-CPPFLAGS += -DTOP_NAMESPACE=glibc
-endif
+	   $(CPPFLAGS-$(<F)) $(CPPFLAGS-$(@F)) $(CPPFLAGS-$(basename $(@F))) \
+	   -DTOP_NAMESPACE=glibc
 
 override CFLAGS	= -std=gnu11 -fgnu89-inline $(config-extra-cflags) \
 		  $(filter-out %frame-pointer,$(+cflags)) $(+gccwarn-c) \
@@ -1203,7 +1200,6 @@ endif
 
 # Build the tunables list header early since it could be used by any module in
 # glibc.
-ifneq (no,$(have-tunables))
 before-compile += $(common-objpfx)dl-tunable-list.h
 common-generated += dl-tunable-list.h dl-tunable-list.stmp
 
@@ -1216,7 +1212,6 @@ $(common-objpfx)dl-tunable-list.stmp: \
 	$(AWK) -f $^ > ${@:stmp=T}
 	$(move-if-change) ${@:stmp=T} ${@:stmp=h}
 	touch $@
-endif
 
 # Dump the GCC macros used by the default compiler flags to a header
 # file, so that they can be inspected when using different compiler
diff --git a/NEWS b/NEWS
index d5816923c6..83d082afad 100644
--- a/NEWS
+++ b/NEWS
@@ -34,6 +34,9 @@ Deprecated and removed features, and other changes affecting compatibility:
   cache can still be disable per-application using tunables
   (glibc.malloc.tcache_count set to zero).
 
+* The configure option --enable-tunables has been removed.  The tunable
+  feature is now always enabled.
+
 Changes to build and runtime requirements:
 
   [Add changes to build and runtime requirements here]
diff --git a/config.h.in b/config.h.in
index 09730d9d52..c87008b6a9 100644
--- a/config.h.in
+++ b/config.h.in
@@ -271,9 +271,6 @@
 /* PowerPC32 uses fctidz for floating point to long long conversions.  */
 #define HAVE_PPC_FCTIDZ 0
 
-/* Build glibc with tunables support.  */
-#define HAVE_TUNABLES 0
-
 /* Define if PIE is unsupported.  */
 #undef PIE_UNSUPPORTED
 
diff --git a/config.make.in b/config.make.in
index dce93ecf73..4afd37feaf 100644
--- a/config.make.in
+++ b/config.make.in
@@ -93,7 +93,6 @@ build-nscd = @build_nscd@
 use-nscd = @use_nscd@
 build-hardcoded-path-in-tests= @hardcoded_path_in_tests@
 build-pt-chown = @build_pt_chown@
-have-tunables = @have_tunables@
 pthread-in-libc = @pthread_in_libc@
 
 # Build tools.
diff --git a/configure b/configure
index 904fc689e7..f84040644b 100755
--- a/configure
+++ b/configure
@@ -664,7 +664,6 @@ INSTALL_DATA
 INSTALL_SCRIPT
 INSTALL_PROGRAM
 base_machine
-have_tunables
 build_pt_chown
 build_nscd
 libc_cv_static_nss_crypt
@@ -780,7 +779,6 @@ enable_systemtap
 enable_build_nscd
 enable_nscd
 enable_pt_chown
-enable_tunables
 enable_mathvec
 enable_cet
 enable_scv
@@ -1448,8 +1446,6 @@ Optional Features:
   --disable-build-nscd    disable building and installing the nscd daemon
   --disable-nscd          library functions will not contact the nscd daemon
   --enable-pt_chown       Enable building and installing pt_chown
-  --enable-tunables       Enable tunables support. Known values are 'yes',
-                          'no' and 'valstring'
   --enable-mathvec        Enable building and installing mathvec [default
                           depends on architecture]
   --enable-cet            enable Intel Control-flow Enforcement Technology
@@ -3658,19 +3654,6 @@ if test "$build_pt_chown" = yes; then
 
 fi
 
-# Check whether --enable-tunables was given.
-if test "${enable_tunables+set}" = set; then :
-  enableval=$enable_tunables; have_tunables=$enableval
-else
-  have_tunables=yes
-fi
-
-
-if test "$have_tunables" = yes; then
-  $as_echo "#define HAVE_TUNABLES 1" >>confdefs.h
-
-fi
-
 # The abi-tags file uses a fairly simplistic model for name recognition that
 # can't distinguish i486-pc-linux-gnu fully from i486-pc-gnu.  So we mutate a
 # $host_os of `gnu*' here to be `gnu-gnu*' just so that it can tell.
diff --git a/configure.ac b/configure.ac
index 48ca0d3707..88df3e5eed 100644
--- a/configure.ac
+++ b/configure.ac
@@ -427,16 +427,6 @@ if test "$build_pt_chown" = yes; then
   AC_DEFINE(HAVE_PT_CHOWN)
 fi
 
-AC_ARG_ENABLE([tunables],
-	      [AS_HELP_STRING([--enable-tunables],
-	       [Enable tunables support. Known values are 'yes', 'no' and 'valstring'])],
-	      [have_tunables=$enableval],
-	      [have_tunables=yes])
-AC_SUBST(have_tunables)
-if test "$have_tunables" = yes; then
-  AC_DEFINE(HAVE_TUNABLES)
-fi
-
 # The abi-tags file uses a fairly simplistic model for name recognition that
 # can't distinguish i486-pc-linux-gnu fully from i486-pc-gnu.  So we mutate a
 # $host_os of `gnu*' here to be `gnu-gnu*' just so that it can tell.
diff --git a/elf/Makefile b/elf/Makefile
index 8cf46ba782..396ec51424 100644
--- a/elf/Makefile
+++ b/elf/Makefile
@@ -82,6 +82,7 @@ dl-routines = \
   dl-tls \
   dl-tls_init_tp \
   dl-trampoline \
+  dl-tunables \
   dl-version \
   dl-write \
   # dl-routines
@@ -90,11 +91,6 @@ ifeq (yes,$(use-ldconfig))
 dl-routines += dl-cache
 endif
 
-ifneq (no,$(have-tunables))
-dl-routines += dl-tunables
-tunables-type = $(addprefix TUNABLES_FRONTEND_,$(have-tunables))
-CPPFLAGS-dl-tunables.c += -DTUNABLES_FRONTEND=$(tunables-type)
-
 ifeq (yesyes,$(build-shared)$(run-built-tests))
 tests-special += $(objpfx)list-tunables.out
 endif
@@ -104,7 +100,6 @@ endif
 ifeq (yes,$(have-loop-to-function))
 CFLAGS-dl-tunables.c += -fno-tree-loop-distribute-patterns
 endif
-endif
 
 all-dl-routines = $(dl-routines) $(sysdep-dl-routines)
 # But they are absent from the shared libc, because that code is in ld.so.
@@ -1173,7 +1168,6 @@ postclean-generated += $(objpfx)/dso-sort-tests-2.generated-makefile \
 		       $(objpfx)/dso-sort-tests-2.generated-makefile
 
 # Generate from each testcase description file
-ifeq (yes,$(have-tunables))
 $(eval $(call include_dsosort_tests,dso-sort-tests-1.def))
 $(eval $(call include_dsosort_tests,dso-sort-tests-2.def))
 
@@ -1181,7 +1175,6 @@ $(eval $(call include_dsosort_tests,dso-sort-tests-2.def))
 LDFLAGS-tst-bz15311-b.so += -Wl,-z,lazy
 LDFLAGS-tst-bz15311-c.so += -Wl,-z,lazy
 LDFLAGS-tst-bz15311-d.so += -Wl,-z,lazy
-endif
 
 check-abi: $(objpfx)check-abi-ld.out \
 	   $(objpfx)check-abi-version-libc.out
diff --git a/elf/dl-cache.c b/elf/dl-cache.c
index 07c054b11a..631286832d 100644
--- a/elf/dl-cache.c
+++ b/elf/dl-cache.c
@@ -205,7 +205,7 @@ search_cache (const char *string_table, uint32_t string_table_size,
   uint64_t platform = _dl_string_platform (GLRO (dl_platform));
   if (platform != (uint64_t) -1)
     platform = 1ULL << platform;
-  uint64_t hwcap_mask = GET_HWCAP_MASK ();
+  uint64_t hwcap_mask = TUNABLE_GET (glibc, cpu, hwcap_mask, uint64_t, NULL);
 #define _DL_HWCAP_TLS_MASK (1LL << 63)
   uint64_t hwcap_exclude = ~((GLRO (dl_hwcap) & hwcap_mask)
 			     | _DL_HWCAP_PLATFORM | _DL_HWCAP_TLS_MASK);
diff --git a/elf/dl-hwcaps.h b/elf/dl-hwcaps.h
index abe6aaf7c5..3012ebf2b4 100644
--- a/elf/dl-hwcaps.h
+++ b/elf/dl-hwcaps.h
@@ -24,17 +24,6 @@
 
 #include <elf/dl-tunables.h>
 
-#if HAVE_TUNABLES
-# define GET_HWCAP_MASK() TUNABLE_GET (glibc, cpu, hwcap_mask, uint64_t, NULL)
-#else
-# ifdef SHARED
-#   define GET_HWCAP_MASK() GLRO(dl_hwcap_mask)
-# else
-/* HWCAP_MASK is ignored in static binaries when built without tunables.  */
-#  define GET_HWCAP_MASK() (0)
-# endif
-#endif
-
 #define GLIBC_HWCAPS_SUBDIRECTORY "glibc-hwcaps"
 #define GLIBC_HWCAPS_PREFIX GLIBC_HWCAPS_SUBDIRECTORY "/"
 
diff --git a/elf/dl-sort-maps.c b/elf/dl-sort-maps.c
index 325e96388e..5616c8a6a3 100644
--- a/elf/dl-sort-maps.c
+++ b/elf/dl-sort-maps.c
@@ -121,11 +121,6 @@ _dl_sort_maps_original (struct link_map **maps, unsigned int nmaps,
     }
 }
 
-#if !HAVE_TUNABLES
-/* In this case, just default to the original algorithm.  */
-strong_alias (_dl_sort_maps_original, _dl_sort_maps);
-#else
-
 /* We use a recursive function due to its better clarity and ease of
    implementation, as well as faster execution speed. We already use
    alloca() for list allocation during the breadth-first search of
@@ -314,5 +309,3 @@ _dl_sort_maps (struct link_map **maps, unsigned int nmaps,
   else
     _dl_sort_maps_dfs (maps, nmaps, force_first, for_fini);
 }
-
-#endif /* HAVE_TUNABLES.  */
diff --git a/elf/dl-support.c b/elf/dl-support.c
index d2519ce1a9..322599916f 100644
--- a/elf/dl-support.c
+++ b/elf/dl-support.c
@@ -168,16 +168,6 @@ enum dso_sort_algorithm _dl_dso_sort_algo;
 /* The value of the FPU control word the kernel will preset in hardware.  */
 fpu_control_t _dl_fpu_control = _FPU_DEFAULT;
 
-#if !HAVE_TUNABLES
-/* This is not initialized to HWCAP_IMPORTANT, matching the definition
-   of _dl_important_hwcaps, below, where no hwcap strings are ever
-   used.  This mask is still used to mediate the lookups in the cache
-   file.  Since there is no way to set this nonzero (we don't grok the
-   LD_HWCAP_MASK environment variable here), there is no real point in
-   setting _dl_hwcap nonzero below, but we do anyway.  */
-uint64_t _dl_hwcap_mask;
-#endif
-
 /* Prevailing state of the stack.  Generally this includes PF_X, indicating it's
  * executable but this isn't true for all platforms.  */
 ElfW(Word) _dl_stack_flags = DEFAULT_STACK_PERMS;
@@ -328,11 +318,6 @@ _dl_non_dynamic_init (void)
 	  __unsetenv (cp);
 	  cp = strchr (cp, '\0') + 1;
 	}
-
-#if !HAVE_TUNABLES
-      if (__access ("/etc/suid-debug", F_OK) != 0)
-	__unsetenv ("MALLOC_CHECK_");
-#endif
     }
 
 #ifdef DL_PLATFORM_INIT
diff --git a/elf/dl-tls.c b/elf/dl-tls.c
index 8943a3b4ae..4ef7bc3f1e 100644
--- a/elf/dl-tls.c
+++ b/elf/dl-tls.c
@@ -97,14 +97,8 @@ _dl_tls_static_surplus_init (size_t naudit)
 {
   size_t nns, opt_tls;
 
-#if HAVE_TUNABLES
   nns = TUNABLE_GET (nns, size_t, NULL);
   opt_tls = TUNABLE_GET (optional_static_tls, size_t, NULL);
-#else
-  /* Default values of the tunables.  */
-  nns = DEFAULT_NNS;
-  opt_tls = OPTIONAL_TLS;
-#endif
   if (nns > DL_NNS)
     nns = DL_NNS;
   if (DL_NNS - nns < naudit)
diff --git a/elf/dl-tunables.c b/elf/dl-tunables.c
index 327b9eb52f..62b7332d95 100644
--- a/elf/dl-tunables.c
+++ b/elf/dl-tunables.c
@@ -38,11 +38,6 @@
 
 #include <not-errno.h>
 
-#if TUNABLES_FRONTEND == TUNABLES_FRONTEND_valstring
-# define GLIBC_TUNABLES "GLIBC_TUNABLES"
-#endif
-
-#if TUNABLES_FRONTEND == TUNABLES_FRONTEND_valstring
 static char *
 tunables_strdup (const char *in)
 {
@@ -62,7 +57,6 @@ tunables_strdup (const char *in)
 
   return out;
 }
-#endif
 
 static char **
 get_next_env (char **envp, char **name, size_t *namelen, char **val,
@@ -160,7 +154,6 @@ __tunable_set_val (tunable_id_t id, tunable_val_t *valp, tunable_num_t *minp,
   do_tunable_update_val (cur, valp, minp, maxp);
 }
 
-#if TUNABLES_FRONTEND == TUNABLES_FRONTEND_valstring
 /* Parse the tunable string TUNESTR and adjust it to drop any tunables that may
    be unsafe for AT_SECURE processes so that it can be used as the new
    environment variable value for GLIBC_TUNABLES.  VALSTRING is the original
@@ -255,7 +248,6 @@ parse_tunables (char *tunestr, char *valstring)
 	p += len + 1;
     }
 }
-#endif
 
 /* Enable the glibc.malloc.check tunable in SETUID/SETGID programs only when
    the system administrator has created the /etc/suid-debug file.  This is a
@@ -287,8 +279,7 @@ __tunables_init (char **envp)
   while ((envp = get_next_env (envp, &envname, &len, &envval,
 			       &prev_envp)) != NULL)
     {
-#if TUNABLES_FRONTEND == TUNABLES_FRONTEND_valstring
-      if (tunable_is_name (GLIBC_TUNABLES, envname))
+      if (tunable_is_name ("GLIBC_TUNABLES", envname))
 	{
 	  char *new_env = tunables_strdup (envname);
 	  if (new_env != NULL)
@@ -297,7 +288,6 @@ __tunables_init (char **envp)
 	  *prev_envp = new_env;
 	  continue;
 	}
-#endif
 
       for (int i = 0; i < sizeof (tunable_list) / sizeof (tunable_t); i++)
 	{
diff --git a/elf/dl-tunables.h b/elf/dl-tunables.h
index ae6e014b95..45c191e021 100644
--- a/elf/dl-tunables.h
+++ b/elf/dl-tunables.h
@@ -21,17 +21,9 @@
 #ifndef _TUNABLES_H_
 #define _TUNABLES_H_
 
-#if !HAVE_TUNABLES
-static inline void
-__always_inline
-__tunables_init (char **unused __attribute__ ((unused)))
-{
-  /* This is optimized out if tunables are not enabled.  */
-}
-#else
-# include <stdbool.h>
-# include <stddef.h>
-# include <stdint.h>
+#include <stdbool.h>
+#include <stddef.h>
+#include <stdint.h>
 
 typedef intmax_t tunable_num_t;
 
@@ -44,12 +36,12 @@ typedef union
 typedef void (*tunable_callback_t) (tunable_val_t *);
 
 /* Full name for a tunable is top_ns.tunable_ns.id.  */
-# define TUNABLE_NAME_S(top,ns,id) #top "." #ns "." #id
+#define TUNABLE_NAME_S(top,ns,id) #top "." #ns "." #id
 
-# define TUNABLE_ENUM_NAME(__top,__ns,__id) TUNABLE_ENUM_NAME1 (__top,__ns,__id)
-# define TUNABLE_ENUM_NAME1(__top,__ns,__id) __top ## _ ## __ns ## _ ## __id
+#define TUNABLE_ENUM_NAME(__top,__ns,__id) TUNABLE_ENUM_NAME1 (__top,__ns,__id)
+#define TUNABLE_ENUM_NAME1(__top,__ns,__id) __top ## _ ## __ns ## _ ## __id
 
-# include "dl-tunable-list.h"
+#include "dl-tunable-list.h"
 
 extern void __tunables_init (char **);
 extern void __tunables_print (void);
@@ -83,7 +75,7 @@ rtld_hidden_proto (__tunable_set_val)
 
 /* Get and return a tunable value.  If the tunable was set externally and __CB
    is defined then call __CB before returning the value.  */
-# define TUNABLE_GET_FULL(__top, __ns, __id, __type, __cb) \
+#define TUNABLE_GET_FULL(__top, __ns, __id, __type, __cb) \
 ({									      \
   tunable_id_t id = TUNABLE_ENUM_NAME (__top, __ns, __id);		      \
   __type ret;								      \
@@ -92,14 +84,14 @@ rtld_hidden_proto (__tunable_set_val)
 })
 
 /* Set a tunable value.  */
-# define TUNABLE_SET_FULL(__top, __ns, __id, __val) \
+#define TUNABLE_SET_FULL(__top, __ns, __id, __val) \
 ({									      \
   __tunable_set_val (TUNABLE_ENUM_NAME (__top, __ns, __id),		      \
 		     & (tunable_val_t) {.numval = __val}, NULL, NULL);	      \
 })
 
 /* Set a tunable value together with min/max values.  */
-# define TUNABLE_SET_WITH_BOUNDS_FULL(__top, __ns, __id,__val, __min, __max)  \
+#define TUNABLE_SET_WITH_BOUNDS_FULL(__top, __ns, __id,__val, __min, __max)  \
 ({									      \
   __tunable_set_val (TUNABLE_ENUM_NAME (__top, __ns, __id),		      \
 		     & (tunable_val_t) {.numval = __val},		      \
@@ -109,11 +101,7 @@ rtld_hidden_proto (__tunable_set_val)
 
 /* Namespace sanity for callback functions.  Use this macro to keep the
    namespace of the modules clean.  */
-# define TUNABLE_CALLBACK(__name) _dl_tunable_ ## __name
-
-# define TUNABLES_FRONTEND_valstring 1
-/* The default value for TUNABLES_FRONTEND.  */
-# define TUNABLES_FRONTEND_yes TUNABLES_FRONTEND_valstring
+#define TUNABLE_CALLBACK(__name) _dl_tunable_ ## __name
 
 static __always_inline bool
 tunable_val_lt (tunable_num_t lhs, tunable_num_t rhs, bool unsigned_cmp)
@@ -149,4 +137,3 @@ tunable_is_name (const char *orig, const char *envname)
 }
 
 #endif
-#endif
diff --git a/elf/dl-usage.c b/elf/dl-usage.c
index 53535c1583..98f0b0d027 100644
--- a/elf/dl-usage.c
+++ b/elf/dl-usage.c
@@ -195,12 +195,8 @@ setting environment variables (which would be inherited by subprocesses).\n\
                         in LIST\n\
   --audit LIST          use objects named in LIST as auditors\n\
   --preload LIST        preload objects named in LIST\n\
-  --argv0 STRING        set argv[0] to STRING before running\n"
-#if HAVE_TUNABLES
-"\
-  --list-tunables       list all tunables with minimum and maximum values\n"
-#endif
-"\
+  --argv0 STRING        set argv[0] to STRING before running\n\
+  --list-tunables       list all tunables with minimum and maximum values\n\
   --list-diagnostics    list diagnostics information\n\
   --help                display this help and exit\n\
   --version             output version information and exit\n\
diff --git a/elf/rtld.c b/elf/rtld.c
index f82fbeb132..c1e383b055 100644
--- a/elf/rtld.c
+++ b/elf/rtld.c
@@ -357,9 +357,6 @@ struct rtld_global_ro _rtld_global_ro attribute_relro =
     ._dl_sysinfo = DL_SYSINFO_DEFAULT,
 #endif
     ._dl_debug_fd = STDERR_FILENO,
-#if !HAVE_TUNABLES
-    ._dl_hwcap_mask = HWCAP_IMPORTANT,
-#endif
     ._dl_lazy = 1,
     ._dl_fpu_control = _FPU_DEFAULT,
     ._dl_pagesize = EXEC_PAGESIZE,
@@ -1483,7 +1480,6 @@ dl_main (const ElfW(Phdr) *phdr,
 	    _dl_argc -= 2;
 	    _dl_argv += 2;
 	  }
-#if HAVE_TUNABLES
 	else if (! strcmp (_dl_argv[1], "--list-tunables"))
 	  {
 	    state.mode = rtld_mode_list_tunables;
@@ -1491,7 +1487,6 @@ dl_main (const ElfW(Phdr) *phdr,
 	    --_dl_argc;
 	    ++_dl_argv;
 	  }
-#endif
 	else if (! strcmp (_dl_argv[1], "--list-diagnostics"))
 	  {
 	    state.mode = rtld_mode_list_diagnostics;
@@ -1519,13 +1514,11 @@ dl_main (const ElfW(Phdr) *phdr,
 	else
 	  break;
 
-#if HAVE_TUNABLES
       if (__glibc_unlikely (state.mode == rtld_mode_list_tunables))
 	{
 	  __tunables_print ();
 	  _exit (0);
 	}
-#endif
 
       if (state.mode == rtld_mode_list_diagnostics)
 	_dl_print_diagnostics (_environ);
@@ -2624,15 +2617,6 @@ process_envvars (struct dl_main_state *state)
 	    _dl_show_auxv ();
 	  break;
 
-#if !HAVE_TUNABLES
-	case 10:
-	  /* Mask for the important hardware capabilities.  */
-	  if (!__libc_enable_secure
-	      && memcmp (envline, "HWCAP_MASK", 10) == 0)
-	    GLRO(dl_hwcap_mask) = _dl_strtoul (&envline[11], NULL);
-	  break;
-#endif
-
 	case 11:
 	  /* Path where the binary is found.  */
 	  if (!__libc_enable_secure
@@ -2695,12 +2679,7 @@ process_envvars (struct dl_main_state *state)
       while (*nextp != '\0');
 
       if (__access ("/etc/suid-debug", F_OK) != 0)
-	{
-#if !HAVE_TUNABLES
-	  unsetenv ("MALLOC_CHECK_");
-#endif
-	  GLRO(dl_debug_mask) = 0;
-	}
+	GLRO(dl_debug_mask) = 0;
 
       if (state->mode != rtld_mode_normal)
 	_exit (5);
diff --git a/elf/tst-env-setuid-tunables.c b/elf/tst-env-setuid-tunables.c
index 807b426012..7dfb0e073a 100644
--- a/elf/tst-env-setuid-tunables.c
+++ b/elf/tst-env-setuid-tunables.c
@@ -19,8 +19,6 @@
    glibc.malloc.check and glibc.malloc.mmap_threshold but also retain
    glibc.malloc.mmap_threshold in an unprivileged child.  */
 
-/* This is compiled as part of the testsuite but needs to see
-   HAVE_TUNABLES. */
 #define _LIBC 1
 #include "config.h"
 #undef _LIBC
@@ -83,7 +81,6 @@ test_child (int off)
 {
   const char *val = getenv ("GLIBC_TUNABLES");
 
-#if HAVE_TUNABLES
   if (val != NULL && strcmp (val, resultstrings[off]) == 0)
     return 0;
 
@@ -91,14 +88,6 @@ test_child (int off)
     printf ("[%d] Unexpected GLIBC_TUNABLES VALUE %s\n", off, val);
 
   return 1;
-#else
-  if (val != NULL)
-    {
-      printf ("[%d] GLIBC_TUNABLES not cleared\n", off);
-      return 1;
-    }
-  return 0;
-#endif
 }
 
 static int
diff --git a/gmon/gmon.c b/gmon/gmon.c
index 5e99a7351d..bc0e29438a 100644
--- a/gmon/gmon.c
+++ b/gmon/gmon.c
@@ -46,10 +46,8 @@
 #include <libc-internal.h>
 #include <not-cancel.h>
 
-#if HAVE_TUNABLES
-# define TUNABLE_NAMESPACE gmon
-# include <elf/dl-tunables.h>
-#endif
+#define TUNABLE_NAMESPACE gmon
+#include <elf/dl-tunables.h>
 
 #ifdef PIC
 # include <link.h>
@@ -130,7 +128,6 @@ __monstartup (u_long lowpc, u_long highpc)
   struct gmonparam *p = &_gmonparam;
   long int minarcs, maxarcs;
 
-#if HAVE_TUNABLES
   /* Read minarcs/maxarcs tunables. */
   minarcs = TUNABLE_GET (minarcs, int32_t, NULL);
   maxarcs = TUNABLE_GET (maxarcs, int32_t, NULL);
@@ -139,11 +136,6 @@ __monstartup (u_long lowpc, u_long highpc)
       ERR("monstartup: maxarcs < minarcs, setting maxarcs = minarcs\n");
       maxarcs = minarcs;
     }
-#else
-  /* No tunables, we use hardcoded defaults */
-  minarcs = MINARCS;
-  maxarcs = MAXARCS;
-#endif
 
   /*
    * If we are incorrectly called twice in a row (without an
diff --git a/malloc/Makefile b/malloc/Makefile
index f685fc6e6c..0717df626e 100644
--- a/malloc/Makefile
+++ b/malloc/Makefile
@@ -61,9 +61,7 @@ tests-internal += \
 	 tst-dynarray-fail \
 	 tst-dynarray-at-fail \
 
-ifneq (no,$(have-tunables))
 tests += tst-malloc-usable-tunables tst-mxfast
-endif
 
 tests += $(tests-static)
 test-srcs = tst-mtrace
diff --git a/malloc/arena.c b/malloc/arena.c
index ccd193953b..e98b779dbb 100644
--- a/malloc/arena.c
+++ b/malloc/arena.c
@@ -18,9 +18,7 @@
 
 #include <stdbool.h>
 
-#if HAVE_TUNABLES
-# define TUNABLE_NAMESPACE malloc
-#endif
+#define TUNABLE_NAMESPACE malloc
 #include <elf/dl-tunables.h>
 
 /* Compile-time constants.  */
@@ -47,21 +45,13 @@
 static inline size_t
 heap_min_size (void)
 {
-#if HAVE_TUNABLES
   return mp_.hp_pagesize == 0 ? HEAP_MIN_SIZE : mp_.hp_pagesize;
-#else
-  return HEAP_MIN_SIZE;
-#endif
 }
 
 static inline size_t
 heap_max_size (void)
 {
-#if HAVE_TUNABLES
   return mp_.hp_pagesize == 0 ? HEAP_MAX_SIZE : mp_.hp_pagesize * 4;
-#else
-  return HEAP_MAX_SIZE;
-#endif
 }
 
 /***************************************************************************/
@@ -239,8 +229,7 @@ __malloc_fork_unlock_child (void)
   __libc_lock_init (list_lock);
 }
 
-#if HAVE_TUNABLES
-# define TUNABLE_CALLBACK_FNDECL(__name, __type) \
+#define TUNABLE_CALLBACK_FNDECL(__name, __type) \
 static inline int do_ ## __name (__type value);				      \
 static void									      \
 TUNABLE_CALLBACK (__name) (tunable_val_t *valp)				      \
@@ -263,42 +252,6 @@ TUNABLE_CALLBACK_FNDECL (set_tcache_unsorted_limit, size_t)
 #endif
 TUNABLE_CALLBACK_FNDECL (set_mxfast, size_t)
 TUNABLE_CALLBACK_FNDECL (set_hugetlb, size_t)
-#else
-/* Initialization routine. */
-#include <string.h>
-extern char **_environ;
-
-static char *
-next_env_entry (char ***position)
-{
-  char **current = *position;
-  char *result = NULL;
-
-  while (*current != NULL)
-    {
-      if (__builtin_expect ((*current)[0] == 'M', 0)
-          && (*current)[1] == 'A'
-          && (*current)[2] == 'L'
-          && (*current)[3] == 'L'
-          && (*current)[4] == 'O'
-          && (*current)[5] == 'C'
-          && (*current)[6] == '_')
-        {
-          result = &(*current)[7];
-
-          /* Save current position for next visit.  */
-          *position = ++current;
-
-          break;
-        }
-
-      ++current;
-    }
-
-  return result;
-}
-#endif
-
 
 #if USE_TCACHE
 static void tcache_key_initialize (void);
@@ -343,7 +296,6 @@ ptmalloc_init (void)
 
   malloc_init_state (&main_arena);
 
-#if HAVE_TUNABLES
   TUNABLE_GET (top_pad, size_t, TUNABLE_CALLBACK (set_top_pad));
   TUNABLE_GET (perturb, int32_t, TUNABLE_CALLBACK (set_perturb_byte));
   TUNABLE_GET (mmap_threshold, size_t, TUNABLE_CALLBACK (set_mmap_threshold));
@@ -363,70 +315,6 @@ ptmalloc_init (void)
     /* Force mmap for main arena instead of sbrk, so hugepages are explicitly
        used.  */
     __always_fail_morecore = true;
-#else
-  if (__glibc_likely (_environ != NULL))
-    {
-      char **runp = _environ;
-      char *envline;
-
-      while (__builtin_expect ((envline = next_env_entry (&runp)) != NULL,
-                               0))
-        {
-          size_t len = strcspn (envline, "=");
-
-          if (envline[len] != '=')
-            /* This is a "MALLOC_" variable at the end of the string
-               without a '=' character.  Ignore it since otherwise we
-               will access invalid memory below.  */
-            continue;
-
-          switch (len)
-            {
-            case 8:
-              if (!__builtin_expect (__libc_enable_secure, 0))
-                {
-                  if (memcmp (envline, "TOP_PAD_", 8) == 0)
-                    __libc_mallopt (M_TOP_PAD, strtol (&envline[9], NULL, 10));
-                  else if (memcmp (envline, "PERTURB_", 8) == 0)
-                    __libc_mallopt (M_PERTURB, strtol (&envline[9], NULL, 10));
-                }
-              break;
-            case 9:
-              if (!__builtin_expect (__libc_enable_secure, 0))
-                {
-                  if (memcmp (envline, "MMAP_MAX_", 9) == 0)
-                    __libc_mallopt (M_MMAP_MAX, strtol (&envline[10],
-							NULL, 10));
-                  else if (memcmp (envline, "ARENA_MAX", 9) == 0)
-                    __libc_mallopt (M_ARENA_MAX, strtol (&envline[10],
-							 NULL, 10));
-                }
-              break;
-            case 10:
-              if (!__builtin_expect (__libc_enable_secure, 0))
-                {
-                  if (memcmp (envline, "ARENA_TEST", 10) == 0)
-                    __libc_mallopt (M_ARENA_TEST, strtol (&envline[11],
-							  NULL, 10));
-                }
-              break;
-            case 15:
-              if (!__builtin_expect (__libc_enable_secure, 0))
-                {
-                  if (memcmp (envline, "TRIM_THRESHOLD_", 15) == 0)
-                    __libc_mallopt (M_TRIM_THRESHOLD, strtol (&envline[16],
-							      NULL, 10));
-                  else if (memcmp (envline, "MMAP_THRESHOLD_", 15) == 0)
-                    __libc_mallopt (M_MMAP_THRESHOLD, strtol (&envline[16],
-							      NULL, 10));
-                }
-              break;
-            default:
-              break;
-            }
-        }
-    }
-#endif
 }
 
 /* Managing heaps and arenas (for concurrent threads) */
@@ -561,7 +449,6 @@ alloc_new_heap  (size_t size, size_t top_pad, size_t pagesize,
 static heap_info *
 new_heap (size_t size, size_t top_pad)
 {
-#if HAVE_TUNABLES
   if (__glibc_unlikely (mp_.hp_pagesize != 0))
     {
       heap_info *h = alloc_new_heap (size, top_pad, mp_.hp_pagesize,
@@ -569,7 +456,6 @@ new_heap (size_t size, size_t top_pad)
       if (h != NULL)
 	return h;
     }
-#endif
   return alloc_new_heap (size, top_pad, GLRO (dl_pagesize), 0);
 }
 
diff --git a/malloc/malloc-check.c b/malloc/malloc-check.c
index af27fd2c52..5732d81bf1 100644
--- a/malloc/malloc-check.c
+++ b/malloc/malloc-check.c
@@ -376,7 +376,6 @@ memalign_check (size_t alignment, size_t bytes)
   return mem2mem_check (tag_new_usable (mem), bytes);
 }
 
-#if HAVE_TUNABLES
 static void
 TUNABLE_CALLBACK (set_mallopt_check) (tunable_val_t *valp)
 {
@@ -384,7 +383,6 @@ TUNABLE_CALLBACK (set_mallopt_check) (tunable_val_t *valp)
   if (value != 0)
     __malloc_debug_enable (MALLOC_CHECK_HOOK);
 }
-#endif
 
 static bool
 initialize_malloc_check (void)
@@ -392,12 +390,6 @@ initialize_malloc_check (void)
   /* This is the copy of the malloc initializer that we pulled in along with
      malloc-check.  This does not affect any of the libc malloc structures.  */
   ptmalloc_init ();
-#if HAVE_TUNABLES
   TUNABLE_GET (check, int32_t, TUNABLE_CALLBACK (set_mallopt_check));
-#else
-  const char *s = secure_getenv ("MALLOC_CHECK_");
-  if (s && s[0] != '\0' && s[0] != '0')
-    __malloc_debug_enable (MALLOC_CHECK_HOOK);
-#endif
   return __is_malloc_debug_enabled (MALLOC_CHECK_HOOK);
 }
diff --git a/malloc/malloc.c b/malloc/malloc.c
index 76c50e3f58..05e65a2d54 100644
--- a/malloc/malloc.c
+++ b/malloc/malloc.c
@@ -1856,14 +1856,12 @@ struct malloc_par
   INTERNAL_SIZE_T arena_test;
   INTERNAL_SIZE_T arena_max;
 
-#if HAVE_TUNABLES
   /* Transparent Large Page support.  */
   INTERNAL_SIZE_T thp_pagesize;
   /* A value different than 0 means to align mmap allocation to hp_pagesize
      add hp_flags on flags.  */
   INTERNAL_SIZE_T hp_pagesize;
   int hp_flags;
-#endif
 
   /* Memory map support */
   int n_mmaps;
@@ -1998,7 +1996,7 @@ free_perturb (char *p, size_t n)
 static inline void
 madvise_thp (void *p, INTERNAL_SIZE_T size)
 {
-#if HAVE_TUNABLES && defined (MADV_HUGEPAGE)
+#ifdef MADV_HUGEPAGE
   /* Do not consider areas smaller than a huge page or if the tunable is
      not active.  */
   if (mp_.thp_pagesize == 0 || size < mp_.thp_pagesize)
@@ -2557,7 +2555,6 @@ sysmalloc (INTERNAL_SIZE_T nb, mstate av)
 	  && (mp_.n_mmaps < mp_.n_mmaps_max)))
     {
       char *mm;
-#if HAVE_TUNABLES
       if (mp_.hp_pagesize > 0 && nb >= mp_.hp_pagesize)
 	{
 	  /* There is no need to isse the THP madvise call if Huge Pages are
@@ -2566,7 +2563,6 @@ sysmalloc (INTERNAL_SIZE_T nb, mstate av)
 	  if (mm != MAP_FAILED)
 	    return mm;
 	}
-#endif
       mm = sysmalloc_mmap (nb, pagesize, 0, av);
       if (mm != MAP_FAILED)
 	return mm;
@@ -2679,7 +2675,7 @@ sysmalloc (INTERNAL_SIZE_T nb, mstate av)
          previous calls. Otherwise, we correct to page-align below.
        */
 
-#if HAVE_TUNABLES && defined (MADV_HUGEPAGE)
+#ifdef MADV_HUGEPAGE
       /* Defined in brk.c.  */
       extern void *__curbrk;
       if (__glibc_unlikely (mp_.thp_pagesize != 0))
@@ -2718,12 +2714,10 @@ sysmalloc (INTERNAL_SIZE_T nb, mstate av)
            */
 
 	  char *mbrk = MAP_FAILED;
-#if HAVE_TUNABLES
 	  if (mp_.hp_pagesize > 0)
 	    mbrk = sysmalloc_mmap_fallback (&size, nb, old_size,
 					    mp_.hp_pagesize, mp_.hp_pagesize,
 					    mp_.hp_flags, av);
-#endif
 	  if (mbrk == MAP_FAILED)
 	    mbrk = sysmalloc_mmap_fallback (&size, nb, old_size, MMAP_AS_MORECORE_SIZE,
 					    pagesize, 0, av);
@@ -2966,7 +2960,7 @@ systrim (size_t pad, mstate av)
     return 0;
 
   /* Release in pagesize units and round down to the nearest page.  */
-#if HAVE_TUNABLES && defined (MADV_HUGEPAGE)
+#ifdef MADV_HUGEPAGE
   if (__glibc_unlikely (mp_.thp_pagesize != 0))
     extra = ALIGN_DOWN (top_area - pad, mp_.thp_pagesize);
   else
@@ -5410,7 +5404,6 @@ do_set_mxfast (size_t value)
   return 0;
 }
 
-#if HAVE_TUNABLES
 static __always_inline int
 do_set_hugetlb (size_t value)
 {
@@ -5429,7 +5422,6 @@ do_set_hugetlb (size_t value)
 			      &mp_.hp_flags);
   return 0;
 }
-#endif
 
 int
 __libc_mallopt (int param_number, int value)
diff --git a/manual/install.texi b/manual/install.texi
index 37986d8b0c..f507ebff7b 100644
--- a/manual/install.texi
+++ b/manual/install.texi
@@ -256,25 +256,6 @@ configure with @option{--disable-werror}.
 By default for x86_64, @theglibc{} is built with the vector math library.
 Use this option to disable the vector math library.
 
-@item --enable-tunables
-Tunables support allows additional library parameters to be customized at
-runtime.  This feature is enabled by default.  This option can take the
-following values:
-
-@table @code
-@item yes
-This is the default if no option is passed to configure. This enables tunables
-and selects the default frontend (currently @samp{valstring}).
-
-@item no
-This option disables tunables.
-
-@item valstring
-This enables tunables and selects the @samp{valstring} frontend for tunables.
-This frontend allows users to specify tunables as a colon-separated list in a
-single environment variable @env{GLIBC_TUNABLES}.
-@end table
-
 @item --disable-crypt
 Do not install the passphrase-hashing library @file{libcrypt} or the
 header file @file{crypt.h}.  @file{unistd.h} will still declare the
diff --git a/nptl/pthread_mutex_conf.c b/nptl/pthread_mutex_conf.c
index 329c4cbb8f..9133384d47 100644
--- a/nptl/pthread_mutex_conf.c
+++ b/nptl/pthread_mutex_conf.c
@@ -16,8 +16,7 @@
    License along with the GNU C Library; if not, see
    <https://www.gnu.org/licenses/>.  */
 
-#if HAVE_TUNABLES
-# define TUNABLE_NAMESPACE pthread
+#define TUNABLE_NAMESPACE pthread
 #include <pthread_mutex_conf.h>
 #include <stdint.h>
 #include <stdbool.h>
@@ -53,4 +52,3 @@ __pthread_tunables_init (void)
   TUNABLE_GET (stack_cache_size, size_t,
                TUNABLE_CALLBACK (set_stack_cache_size));
 }
-#endif
diff --git a/nptl/tst-mutex8.c b/nptl/tst-mutex8.c
index 4ac5f5059f..e16284d29e 100644
--- a/nptl/tst-mutex8.c
+++ b/nptl/tst-mutex8.c
@@ -98,7 +98,6 @@ check_type (const char *mas, pthread_mutexattr_t *ma)
   /* Check if a mutex will be elided.  Lock elision can only be activated via
      the tunables framework.  By default, lock elision is disabled.  */
   bool assume_elided_mutex = false;
-#if HAVE_TUNABLES
   int ma_type = PTHREAD_MUTEX_TIMED_NP;
   if (ma != NULL)
     {
@@ -117,7 +116,6 @@ check_type (const char *mas, pthread_mutexattr_t *ma)
       if (TUNABLE_GET_FULL (glibc, elision, enable, int32_t, NULL) == 1)
 	assume_elided_mutex = true;
     }
-#endif
 
   e = pthread_mutex_init (m, ma);
   if (e != 0)
diff --git a/scripts/build-many-glibcs.py b/scripts/build-many-glibcs.py
index 9c5c77f423..e8bb82ed9d 100755
--- a/scripts/build-many-glibcs.py
+++ b/scripts/build-many-glibcs.py
@@ -445,7 +445,6 @@ class Context(object):
                                                '--disable-profile',
                                                '--disable-timezone-tools',
                                                '--disable-mathvec',
-                                               '--disable-tunables',
                                                '--disable-crypt',
                                                '--disable-build-nscd',
                                                '--disable-nscd']},
diff --git a/sysdeps/generic/ldsodefs.h b/sysdeps/generic/ldsodefs.h
index c99dad77cc..e1ab272a79 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 b50331b50f..81397fb90b 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 0db0349c4b..50dc778852 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 536b75b582..54f9198681 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 39255d928c..f1a3b65d1a 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 6d4b6ad880..8151bafce7 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 9ed0e5e8c1..0ef3cf89d2 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 afeb9b5638..39f8c23a60 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 835e68925b..9b57ae1a93 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 f8bd12d991..b4323b2604 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 0380f116de..dc09c1c827 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 8cd945a6c5..7c98dbd0d0 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 5911e51097..6a6d6814ee 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 6447bda96b..cfd9a71e31 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 8ff4f27786..1bf7d528b2 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 56fd5fc805..917c26f116 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 7a99e04b73..ec1bc142c4 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 822688e21f..978eb29f72 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 772fb0c4c2..0d4f328585 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 a0474af8d1..ab671487da 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 688eb2d7c4..54396c3c3f 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