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
$(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) \
# 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
$(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
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]
/* 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
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.
INSTALL_SCRIPT
INSTALL_PROGRAM
base_machine
-have_tunables
build_pt_chown
build_nscd
libc_cv_static_nss_crypt
enable_build_nscd
enable_nscd
enable_pt_chown
-enable_tunables
enable_mathvec
enable_cet
enable_scv
--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
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.
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.
dl-tls \
dl-tls_init_tp \
dl-trampoline \
+ dl-tunables \
dl-version \
dl-write \
# dl-routines
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
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.
$(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))
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
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);
#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 "/"
}
}
-#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
else
_dl_sort_maps_dfs (maps, nmaps, force_first, for_fini);
}
-
-#endif /* HAVE_TUNABLES. */
/* 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;
__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
{
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)
#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)
{
return out;
}
-#endif
static char **
get_next_env (char **envp, char **name, size_t *namelen, char **val,
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
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
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)
*prev_envp = new_env;
continue;
}
-#endif
for (int i = 0; i < sizeof (tunable_list) / sizeof (tunable_t); i++)
{
#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;
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);
/* 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; \
})
/* 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}, \
/* 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)
}
#endif
-#endif
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\
._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,
_dl_argc -= 2;
_dl_argv += 2;
}
-#if HAVE_TUNABLES
else if (! strcmp (_dl_argv[1], "--list-tunables"))
{
state.mode = rtld_mode_list_tunables;
--_dl_argc;
++_dl_argv;
}
-#endif
else if (! strcmp (_dl_argv[1], "--list-diagnostics"))
{
state.mode = rtld_mode_list_diagnostics;
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);
_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
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);
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
{
const char *val = getenv ("GLIBC_TUNABLES");
-#if HAVE_TUNABLES
if (val != NULL && strcmp (val, resultstrings[off]) == 0)
return 0;
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
#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>
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);
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
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
#include <stdbool.h>
-#if HAVE_TUNABLES
-# define TUNABLE_NAMESPACE malloc
-#endif
+#define TUNABLE_NAMESPACE malloc
#include <elf/dl-tunables.h>
/* Compile-time constants. */
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
}
/***************************************************************************/
__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) \
#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);
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));
/* 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) */
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,
if (h != NULL)
return h;
}
-#endif
return alloc_new_heap (size, top_pad, GLRO (dl_pagesize), 0);
}
return mem2mem_check (tag_new_usable (mem), bytes);
}
-#if HAVE_TUNABLES
static void
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)
/* 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);
}
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;
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)
&& (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
if (mm != MAP_FAILED)
return mm;
}
-#endif
mm = sysmalloc_mmap (nb, pagesize, 0, av);
if (mm != MAP_FAILED)
return mm;
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))
*/
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);
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
return 0;
}
-#if HAVE_TUNABLES
static __always_inline int
do_set_hugetlb (size_t value)
{
&mp_.hp_flags);
return 0;
}
-#endif
int
__libc_mallopt (int param_number, int value)
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
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>
TUNABLE_GET (stack_cache_size, size_t,
TUNABLE_CALLBACK (set_stack_cache_size));
}
-#endif
/* 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)
{
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)
'--disable-profile',
'--disable-timezone-tools',
'--disable-mathvec',
- '--disable-tunables',
'--disable-crypt',
'--disable-build-nscd',
'--disable-nscd']},
/* 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;
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)
-#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" \
{
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
static inline short max_adaptive_count (void)
{
-#if HAVE_TUNABLES
return __mutex_aconf.spin_count;
-#else
- return DEFAULT_ADAPTIVE_COUNT;
-#endif
}
__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 */
#include <adaptive_spin_count.h>
-#if HAVE_TUNABLES
struct mutex_config
{
int spin_count;
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
#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)
/* 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
}
#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];
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)
cpu_features->stfle_bits[0] = 0ULL;
}
-#if HAVE_TUNABLES
TUNABLE_GET (glibc, cpu, hwcaps, tunable_val_t *, TUNABLE_CALLBACK (set_hwcaps));
-#endif
}
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;
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 \
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;
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. */
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. */
#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.
.skip_trylock_internal_abort = 3,
};
-#if HAVE_TUNABLES
static inline void
__always_inline
do_set_elision_enable (int32_t elision_enable)
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. */
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
#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.
.skip_trylock_internal_abort = 3,
};
-#if HAVE_TUNABLES
static inline void
__always_inline
do_set_elision_enable (int32_t elision_enable)
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. */
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. */
#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.
.skip_trylock_internal_abort = 3,
};
-#if HAVE_TUNABLES
static __always_inline void
do_set_elision_enable (int32_t elision_enable)
{
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. */
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. */
default-abi := 64
ifeq ($(subdir),elf)
-ifneq ($(have-tunables),no)
tests-map-32bit = \
tst-map-32bit-1a \
$(objpfx)tst-map-32bit-1b: $(objpfx)tst-map-32bit-mod.so
endif
-endif
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
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 \
$(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
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
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 \
$(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
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
#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
#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)
{
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
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;
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)
#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 ();
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)) \
{ \
/* 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)) \
{ \
}
/* 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)) \
/* 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)) \
while (*c != '\0');
}
-# if CET_ENABLED
-
+#if CET_ENABLED
attribute_hidden
void
TUNABLE_CALLBACK (set_x86_ibt) (tunable_val_t *valp)
sizeof ("permissive")) == 0)
GL(dl_x86_feature_control).shstk = cet_permissive;
}
-# endif
#endif
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). */
&& !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). */
/* 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);
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
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
# 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