From: Sunil Pandey <skpgkp2@gmail.com>
To: "H.J. Lu" <hjl.tools@gmail.com>
Cc: libc-alpha@sourceware.org, fweimer@redhat.com
Subject: Re: [PATCH v2] x86: Define MINIMUM_X86_ISA_LEVEL in config.h [BZ #31676]
Date: Tue, 23 Apr 2024 17:17:53 -0700 [thread overview]
Message-ID: <CAMAf5_dfwwGQ2_uT2ghNWv44b4AVv8A8LtHRtLSxqpkhCdbWZg@mail.gmail.com> (raw)
In-Reply-To: <20240423205950.52500-1-hjl.tools@gmail.com>
[-- Attachment #1: Type: text/plain, Size: 3499 bytes --]
On Tue, Apr 23, 2024 at 1:59 PM H.J. Lu <hjl.tools@gmail.com> wrote:
> 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.
> ---
> 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 69ac450356..c4cc7d3b9a 100644
> --- a/config.h.in
> +++ b/config.h.in
> @@ -285,6 +285,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.. */
> --
> 2.44.0
>
> LGTM
Reviewed-by: Sunil K Pandey <skpgkp2@gmail.com>
Thanks,
Sunil
[-- Attachment #2: Type: text/html, Size: 5026 bytes --]
prev parent reply other threads:[~2024-04-24 0:19 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-04-23 20:59 [PATCH v2] x86: Define MINIMUM_X86_ISA_LEVEL in config.h [BZ #31676] H.J. Lu
2024-04-24 0:17 ` Sunil Pandey [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/libc/involved.html
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CAMAf5_dfwwGQ2_uT2ghNWv44b4AVv8A8LtHRtLSxqpkhCdbWZg@mail.gmail.com \
--to=skpgkp2@gmail.com \
--cc=fweimer@redhat.com \
--cc=hjl.tools@gmail.com \
--cc=libc-alpha@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).