Behavior of the GNU C Library can be tuned to assume specific hardware capabilities
by setting the following tunables in the cpu
namespace:
This tunable supersedes the LD_HWCAP_MASK
environment variable and is
identical in features.
The AT_HWCAP
key in the Auxiliary Vector specifies instruction set
extensions available in the processor at runtime for some architectures. The
glibc.cpu.hwcap_mask
tunable allows the user to mask out those
capabilities at runtime, thus disabling use of those extensions.
The glibc.cpu.hwcaps=-xxx,yyy,-zzz...
tunable allows the user to
enable CPU/ARCH feature yyy
, disable CPU/ARCH feature xxx
and zzz
where the feature name is case-sensitive and has to match
the ones in sysdeps/x86/include/cpu-features.h
.
On s390x, the supported HWCAP and STFLE features can be found in
sysdeps/s390/cpu-features.c
. In addition the user can also set
a CPU arch-level like z13
instead of single HWCAP and STFLE features.
On powerpc, the supported HWCAP and HWCAP2 features can be found in
sysdeps/powerpc/dl-procinfo.c
.
This tunable is specific to i386, x86-64, s390x and powerpc.
The glibc.cpu.cached_memopt=[0|1]
tunable allows the user to
enable optimizations recommended for cacheable memory. If set to
1
, the GNU C Library assumes that the process memory image consists
of cacheable (non-device) memory only. The default, 0
,
indicates that the process may use device memory.
This tunable is specific to powerpc, powerpc64 and powerpc64le.
The glibc.cpu.name=xxx
tunable allows the user to tell the GNU C Library to
assume that the CPU is xxx
where xxx may have one of these values:
generic
, falkor
, thunderxt88
, thunderx2t99
,
thunderx2t99p1
, ares
, emag
, kunpeng
,
a64fx
.
This tunable is specific to aarch64.
The glibc.cpu.x86_data_cache_size
tunable allows the user to set
data cache size in bytes for use in memory and string routines.
This tunable is specific to i386 and x86-64.
The glibc.cpu.x86_shared_cache_size
tunable allows the user to
set shared cache size in bytes for use in memory and string routines.
The glibc.cpu.x86_non_temporal_threshold
tunable allows the user
to set threshold in bytes for non temporal store. Non temporal stores
give a hint to the hardware to move data directly to memory without
displacing other data from the cache. This tunable is used by some
platforms to determine when to use non temporal stores in operations
like memmove and memcpy.
This tunable is specific to i386 and x86-64.
The glibc.cpu.x86_rep_movsb_threshold
tunable allows the user to
set threshold in bytes to start using "rep movsb". The value must be
greater than zero, and currently defaults to 2048 bytes.
This tunable is specific to i386 and x86-64.
The glibc.cpu.x86_rep_stosb_threshold
tunable allows the user to
set threshold in bytes to start using "rep stosb". The value must be
greater than zero, and currently defaults to 2048 bytes.
This tunable is specific to i386 and x86-64.
The glibc.cpu.x86_ibt
tunable allows the user to control how
indirect branch tracking (IBT) should be enabled. Accepted values are
on
, off
, and permissive
. on
always turns
on IBT regardless of whether IBT is enabled in the executable and its
dependent shared libraries. off
always turns off IBT regardless
of whether IBT is enabled in the executable and its dependent shared
libraries. permissive
is the same as the default which disables
IBT on non-CET executables and shared libraries.
This tunable is specific to i386 and x86-64.
The glibc.cpu.x86_shstk
tunable allows the user to control how
the shadow stack (SHSTK) should be enabled. Accepted values are
on
, off
, and permissive
. on
always turns on
SHSTK regardless of whether SHSTK is enabled in the executable and its
dependent shared libraries. off
always turns off SHSTK regardless
of whether SHSTK is enabled in the executable and its dependent shared
libraries. permissive
changes how dlopen works on non-CET shared
libraries. By default, when SHSTK is enabled, dlopening a non-CET shared
library returns an error. With permissive
, it turns off SHSTK
instead.
This tunable is specific to i386 and x86-64.
When this tunable is set to 1
, shared libraries of non-setuid
programs will be loaded below 2GB with MAP_32BIT.
Note that the LD_PREFER_MAP_32BIT_EXEC
environment is an alias of
this tunable.
This tunable is specific to 64-bit x86-64.