From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2178) id D7C313846013; Thu, 25 Apr 2024 11:18:18 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org D7C313846013 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1714043898; bh=Wc2own0YcZ3q+NfeZ7KJ7bxM1O8zfjhuUpZeO2YrcR0=; h=From:To:Subject:Date:From; b=MoX3w9CQZElYaTCB/h5HcjUOy/QOBPjoX3NUVNzY6ozS0X6xrxYRYXJ80tqbYiHwC LyPSUq+2nqnUQTdoB1Uu05W44Bxh1FavAnCCerkNZ4MmMJLolZNpCJxgYV7Ro8pmic 0zSJYbJvRSIK1Q1/7WFH5weu7CB9k07TUgqn1jx8= MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="utf-8" From: Florian Weimer To: glibc-cvs@sourceware.org Subject: [glibc/release/2.39/master] x86: Define MINIMUM_X86_ISA_LEVEL in config.h [BZ #31676] X-Act-Checkin: glibc X-Git-Author: H.J. Lu X-Git-Refname: refs/heads/release/2.39/master X-Git-Oldrev: e701c7d761f6e5c48d8e9dd5da88cbe2e94943f4 X-Git-Newrev: 2f8f157eb0cc7f1d8d9a3fcaa8c55bed53b092a8 Message-Id: <20240425111818.D7C313846013@sourceware.org> Date: Thu, 25 Apr 2024 11:18:18 +0000 (GMT) List-Id: https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=2f8f157eb0cc7f1d8d9a3fcaa8c55bed53b092a8 commit 2f8f157eb0cc7f1d8d9a3fcaa8c55bed53b092a8 Author: H.J. Lu Date: Tue Apr 23 13:59:50 2024 -0700 x86: Define MINIMUM_X86_ISA_LEVEL in config.h [BZ #31676] Define MINIMUM_X86_ISA_LEVEL at configure time to avoid /usr/bin/ld: …/build/elf/librtld.os: in function `init_cpu_features': …/git/elf/../sysdeps/x86/cpu-features.c:1202: undefined reference to `_dl_runtime_resolve_fxsave' /usr/bin/ld: …/build/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/bin/ld: final link failed: bad value collect2: error: ld returned 1 exit status when glibc is built with -march=x86-64-v3 and configured with --with-rtld-early-cflags=-march=x86-64, which is used to allow ld.so to print an error message on unsupported CPUs: Fatal glibc error: CPU does not support x86-64-v3 This fixes BZ #31676. Reviewed-by: Sunil K Pandey (cherry picked from commit 46c999741340ea559784c20a45077955b50aca43) Diff: --- config.h.in | 3 +++ sysdeps/x86/configure | 7 +++++++ sysdeps/x86/configure.ac | 5 +++++ sysdeps/x86/isa-level.h | 4 +++- 4 files changed, 18 insertions(+), 1 deletion(-) diff --git a/config.h.in b/config.h.in index 4d33c63a84..1e647de585 100644 --- a/config.h.in +++ b/config.h.in @@ -286,6 +286,9 @@ /* Define if x86 ISA level should be included in shared libraries. */ #undef INCLUDE_X86_ISA_LEVEL +/* The x86 ISA level. 1 for baseline. Undefined on non-x86. */ +#undef MINIMUM_X86_ISA_LEVEL + /* Define if -msahf is enabled by default on x86. */ #undef HAVE_X86_LAHF_SAHF diff --git a/sysdeps/x86/configure b/sysdeps/x86/configure index 2a5421bb31..d28d9bcb29 100644 --- a/sysdeps/x86/configure +++ b/sysdeps/x86/configure @@ -151,6 +151,13 @@ printf "%s\n" "$libc_cv_have_x86_isa_level" >&6; } else libc_cv_have_x86_isa_level=baseline fi +if test $libc_cv_have_x86_isa_level = baseline; then + printf "%s\n" "#define MINIMUM_X86_ISA_LEVEL 1" >>confdefs.h + +else + printf "%s\n" "#define MINIMUM_X86_ISA_LEVEL $libc_cv_have_x86_isa_level" >>confdefs.h + +fi config_vars="$config_vars have-x86-isa-level = $libc_cv_have_x86_isa_level" config_vars="$config_vars diff --git a/sysdeps/x86/configure.ac b/sysdeps/x86/configure.ac index 78ff7c8f41..5b0acd03d2 100644 --- a/sysdeps/x86/configure.ac +++ b/sysdeps/x86/configure.ac @@ -105,6 +105,11 @@ EOF else libc_cv_have_x86_isa_level=baseline fi +if test $libc_cv_have_x86_isa_level = baseline; then + AC_DEFINE_UNQUOTED(MINIMUM_X86_ISA_LEVEL, 1) +else + AC_DEFINE_UNQUOTED(MINIMUM_X86_ISA_LEVEL, $libc_cv_have_x86_isa_level) +fi LIBC_CONFIG_VAR([have-x86-isa-level], [$libc_cv_have_x86_isa_level]) LIBC_CONFIG_VAR([x86-isa-level-3-or-above], [3 4]) LIBC_CONFIG_VAR([enable-x86-isa-level], [$libc_cv_include_x86_isa_level]) diff --git a/sysdeps/x86/isa-level.h b/sysdeps/x86/isa-level.h index 11fe1ca90c..2c7f74212b 100644 --- a/sysdeps/x86/isa-level.h +++ b/sysdeps/x86/isa-level.h @@ -61,8 +61,10 @@ # define __X86_ISA_V4 0 #endif -#define MINIMUM_X86_ISA_LEVEL \ +#ifndef MINIMUM_X86_ISA_LEVEL +# define MINIMUM_X86_ISA_LEVEL \ (__X86_ISA_V1 + __X86_ISA_V2 + __X86_ISA_V3 + __X86_ISA_V4) +#endif /* Depending on the minimum ISA level, a feature check result can be a compile-time constant.. */