From befe2d3c4dec8be2cdd01a47132e47bdb7020922 Mon Sep 17 00:00:00 2001 From: "H.J. Lu" Date: Wed, 28 Feb 2024 09:51:14 -0800 Subject: x86-64: Don't use SSE resolvers for ISA level 3 or above When glibc is built with ISA level 3 or above enabled, SSE resolvers aren't available and glibc fails to build: ld: .../elf/librtld.os: in function `init_cpu_features': .../elf/../sysdeps/x86/cpu-features.c:1200:(.text+0x1445f): undefined reference to `_dl_runtime_resolve_fxsave' ld: .../elf/librtld.os: relocation R_X86_64_PC32 against undefined hidden symbol `_dl_runtime_resolve_fxsave' can not be used when making a shared object /usr/local/bin/ld: final link failed: bad value For ISA level 3 or above, don't use _dl_runtime_resolve_fxsave nor _dl_tlsdesc_dynamic_fxsave. This fixes BZ #31429. Reviewed-by: Noah Goldstein --- sysdeps/x86/cpu-features.c | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) (limited to 'sysdeps/x86/cpu-features.c') diff --git a/sysdeps/x86/cpu-features.c b/sysdeps/x86/cpu-features.c index 835113b42f..0ad0a78f67 100644 --- a/sysdeps/x86/cpu-features.c +++ b/sysdeps/x86/cpu-features.c @@ -18,6 +18,7 @@ #include #include +#include #include #include #include @@ -1144,7 +1145,9 @@ no_cpuid: TUNABLE_CALLBACK (set_x86_shstk)); #endif +#if MINIMUM_X86_ISA_LEVEL < AVX_X86_ISA_LEVEL if (GLRO(dl_x86_cpu_features).xsave_state_size != 0) +#endif { if (CPU_FEATURE_USABLE_P (cpu_features, XSAVEC)) { @@ -1165,22 +1168,24 @@ no_cpuid: #endif } } +#if MINIMUM_X86_ISA_LEVEL < AVX_X86_ISA_LEVEL else { -#ifdef __x86_64__ +# ifdef __x86_64__ GLRO(dl_x86_64_runtime_resolve) = _dl_runtime_resolve_fxsave; -# ifdef SHARED +# ifdef SHARED GLRO(dl_x86_tlsdesc_dynamic) = _dl_tlsdesc_dynamic_fxsave; -# endif -#else -# ifdef SHARED +# endif +# else +# ifdef SHARED if (CPU_FEATURE_USABLE_P (cpu_features, FXSR)) GLRO(dl_x86_tlsdesc_dynamic) = _dl_tlsdesc_dynamic_fxsave; else GLRO(dl_x86_tlsdesc_dynamic) = _dl_tlsdesc_dynamic_fnsave; +# endif # endif -#endif } +#endif #ifdef SHARED # ifdef __x86_64__ -- cgit 1.4.1