# --- T2-COPYRIGHT-BEGIN --- # t2/package/*/glibc/hotfix-enlarge-legacy-tls.patch.ia64 # Copyright (C) 2026 The T2 SDE Project # SPDX-License-Identifier: GPL-2.0 or patched project license # --- T2-COPYRIGHT-END --- diff --git a/elf/dl-tls.c b/elf/dl-tls.c index 724691f54e..a222aca2c6 100644 --- a/elf/dl-tls.c +++ b/elf/dl-tls.c @@ -122,9 +122,12 @@ tls_static_surplus (int nns, int opt_tls) /* This value is chosen so that with default values for the tunables, the computation of dl_tls_static_surplus in - _dl_tls_static_surplus_init yields the historic value 1664, for - backwards compatibility. */ -#define LEGACY_TLS (1664 - tls_static_surplus (DEFAULT_NNS, OPTIONAL_TLS)) + _dl_tls_static_surplus_init yields at least 16384 bytes. The + historic value was 1664, but modern libraries such as Mesa's + libEGL_mesa.so.0 (0x1130 bytes) and libgallium.so (0x1120 bytes) + use large initial-exec TLS blocks and require significantly more + surplus to be dlopen'd without error. */ +#define LEGACY_TLS (16384 - tls_static_surplus (DEFAULT_NNS, OPTIONAL_TLS)) /* Calculate the size of the static TLS surplus, when the given number of audit modules are loaded. Must be called after the