[PATCH] configure: Enable SFrame backtracing for x86_64 and AArch64
Sam James
sam@gentoo.org
Tue Jul 15 08:25:01 GMT 2025
claudiu.zissulescu-ianculescu@oracle.com writes:
> From: Claudiu Zissulescu <claudiu.zissulescu-ianculescu@oracle.com>
>
> Update the default SFrame configuration to be disabled by default,
> except on x86_64 and AArch64 architectures, which are fully supported
> by glibc.
Right, gas might gain support for another arch but we may not have the
wiring in glibc.
It looks good but let's await comments.
So:
Reviewed-by: Sam James <sam@gentoo.org>
But I'd like other eyes. CC'd Andreas too as RM.
>
> Signed-off-by: Claudiu Zissulescu <claudiu.zissulescu-ianculescu@oracle.com>
> ---
> INSTALL | 7 ++++---
> NEWS | 6 +++---
> config.make.in | 1 -
> configure | 20 ++++++++------------
> configure.ac | 14 ++++++--------
> manual/install.texi | 7 ++++---
> sysdeps/aarch64/configure | 4 ++++
> sysdeps/aarch64/configure.ac | 4 ++++
> sysdeps/x86_64/configure | 4 ++++
> sysdeps/x86_64/configure.ac | 4 ++++
> 10 files changed, 41 insertions(+), 30 deletions(-)
> mode change 100644 => 100755 sysdeps/x86_64/configure
>
> diff --git a/INSTALL b/INSTALL
> index cf60e1a380..a6089203b9 100644
> --- a/INSTALL
> +++ b/INSTALL
> @@ -292,9 +292,10 @@ passed to 'configure'. For example:
> Default is to disable fortification.
>
> '--disable-sframe'
> - By default, the GNU C Library is built with '-Wa,--gsframe' if the
> - current GNU 'binutils' supports it. You may want to use this
> - option if you don't plan to use SFrame stack tracer.
> + By default for supported architectures (e.g. x86_64 and AArch64),
> + the GNU C Library is built with '-Wa,--gsframe' if the current GNU
> + 'binutils' supports it. You may want to use this option if you
> + don't plan to use SFrame stack tracer.
>
> To build the library and related programs, type 'make'. This will
> produce a lot of output, some of which may look like errors from 'make'
> diff --git a/NEWS b/NEWS
> index 9a92dd098a..59fea5c3e1 100644
> --- a/NEWS
> +++ b/NEWS
> @@ -31,9 +31,9 @@ Major new features:
> glibc.malloc.tcache_max to a larger value (max 4194304).
> Tcache is also significantly faster for small sizes.
>
> -* New stack tracer using SFrame. Introducing --disable-sframe a new
> - configuration flag. Building glibc using sframe is automatically
> - enabled when the build system supports it.
> +* New stack tracer using SFrame format is added for x86_64 and AArch64.
> + It requires Binutils version >= 2.41. It can be disabled via
> + "--disable-sframe".
>
> Deprecated and removed features, and other changes affecting compatibility:
>
> diff --git a/config.make.in b/config.make.in
> index 382e003d87..59897eaec2 100644
> --- a/config.make.in
> +++ b/config.make.in
> @@ -51,7 +51,6 @@ c++-cstdlib-header = @CXX_CSTDLIB_HEADER@
> c++-cmath-header = @CXX_CMATH_HEADER@
> c++-bits-std_abs-h = @CXX_BITS_STD_ABS_H@
> enable-werror = @enable_werror@
> -enable-gsframe = @enable_gsframe@
>
> have-z-execstack = @libc_cv_z_execstack@
> have-no-error-execstack = @libc_cv_no_error_execstack@
> diff --git a/configure b/configure
> index 6595d6be54..8d37495742 100755
> --- a/configure
> +++ b/configure
> @@ -620,7 +620,6 @@ DEFINES
> static_nss
> profile
> libc_cv_multidir
> -enable_gsframe
> READELF_SFRAME
> libc_cv_test_x86_have_amx_tile
> test_enable_cet
> @@ -1510,8 +1509,8 @@ Optional Features:
> Use -D_FORTIFY_SOURCE=[1|2|3] to control code
> hardening, defaults to highest possible value
> supported by the build compiler.
> - --disable-sframe Disable building with SFrame stack trace information
> - [default=yes if GNU as is 2.41 or older]
> + --enable-sframe Enable building with SFrame stack trace information
> + [default depends on architecture]
>
> Optional Packages:
> --with-PACKAGE[=ARG] use PACKAGE [ARG=yes]
> @@ -9459,16 +9458,13 @@ fi
>
> # Prevent enabling sframe on non-supporting toolchains
> enable_gsframe=no
> -if test $use_sframe$libc_cv_default_sframe = yesyes || \
> - test $use_sframe$libc_cv_default_sframe = notsetyes; then
> - enable_gsframe=yes
> -elif test $use_sframe = yes; then
> - { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in '$ac_pwd':" >&5
> -printf "%s\n" "$as_me: error: in '$ac_pwd':" >&2;}
> -as_fn_error $? "toolchain doesn't support SFrame v2 or higher
> -See 'config.log' for more details" "$LINENO" 5; }
> +if test $use_sframe$libc_cv_default_sframe = yesyes; then
> + enable_gsframe=yes
> + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: ...and using SFrame for this build" >&5
> +printf "%s\n" "...and using SFrame for this build" >&6; }
> fi
> -
> +config_vars="$config_vars
> +enable-gsframe = $enable_gsframe"
>
> # Set the `multidir' variable by grabbing the variable from the compiler.
> # We do it once and save the result in a generated makefile.
> diff --git a/configure.ac b/configure.ac
> index 25b80e34e4..93e14bab65 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -441,8 +441,8 @@ case "$enable_fortify_source" in
> esac
>
> AC_ARG_ENABLE([sframe],
> - [AS_HELP_STRING([--disable-sframe],
> - [Disable building with SFrame stack trace information @<:@default=yes if GNU as is 2.41 or older@:>@])],
> + [AS_HELP_STRING([--enable-sframe],
> + [Enable building with SFrame stack trace information @<:@default depends on architecture@:>@])],
> [use_sframe=$enableval],
> [use_sframe=notset])
>
> @@ -2151,13 +2151,11 @@ fi
>
> # Prevent enabling sframe on non-supporting toolchains
> enable_gsframe=no
> -if test $use_sframe$libc_cv_default_sframe = yesyes || \
> - test $use_sframe$libc_cv_default_sframe = notsetyes; then
> - enable_gsframe=yes
> -elif test $use_sframe = yes; then
> - AC_MSG_FAILURE([toolchain doesn't support SFrame v2 or higher])
This is a change in semantics, i.e. --enable-sframe won't error out if
your gas is too old now. But maybe that's fine.
> +if test $use_sframe$libc_cv_default_sframe = yesyes; then
(We should change the libc_cv_default_sframe name later, but not now.)
> + enable_gsframe=yes
> + AC_MSG_RESULT(...and using SFrame for this build)
> fi
> -AC_SUBST(enable_gsframe)
> +LIBC_CONFIG_VAR([enable-gsframe], [$enable_gsframe])
>
> # Set the `multidir' variable by grabbing the variable from the compiler.
> # We do it once and save the result in a generated makefile.
> diff --git a/manual/install.texi b/manual/install.texi
> index 0c8d448362..842894a6c1 100644
> --- a/manual/install.texi
> +++ b/manual/install.texi
> @@ -322,9 +322,10 @@ the build compiler.
> Default is to disable fortification.
>
> @item --disable-sframe
> -By default, the GNU C Library is built with @option{-Wa,--gsframe} if
> -the current GNU @code{binutils} supports it. You may want to use this
> -option if you don't plan to use SFrame stack tracer.
> +By default for supported architectures (e.g. x86_64 and AArch64),
> +@theglibc{} is built with @option{-Wa,--gsframe} if the current GNU
> +@code{binutils} supports it. You may want to use this option if you
> +don't plan to use SFrame stack tracer.
> @end table
>
> To build the library and related programs, type @code{make}. This will
> diff --git a/sysdeps/aarch64/configure b/sysdeps/aarch64/configure
> index 26a0989a33..68f99a53d8 100755
> --- a/sysdeps/aarch64/configure
> +++ b/sysdeps/aarch64/configure
> @@ -194,3 +194,7 @@ if test $build_mathvec = no; then
> printf "%s\n" "$as_me: WARNING: mathvec is disabled, this results in incomplete ABI." >&2;}
> fi
>
> +if test x"$use_sframe" = xnotset ; then
> + use_sframe=yes
> +fi
> +
> diff --git a/sysdeps/aarch64/configure.ac b/sysdeps/aarch64/configure.ac
> index 22fca8b565..405cc5e68b 100644
> --- a/sysdeps/aarch64/configure.ac
> +++ b/sysdeps/aarch64/configure.ac
> @@ -31,3 +31,7 @@ fi
> if test $build_mathvec = no; then
> AC_MSG_WARN([mathvec is disabled, this results in incomplete ABI.])
> fi
> +
> +if test x"$use_sframe" = xnotset ; then
> + use_sframe=yes
> +fi
> diff --git a/sysdeps/x86_64/configure b/sysdeps/x86_64/configure
> old mode 100644
> new mode 100755
> index bbf520bfc9..3f66f79517
> --- a/sysdeps/x86_64/configure
> +++ b/sysdeps/x86_64/configure
> @@ -99,6 +99,10 @@ if test x"$build_mathvec" = xnotset; then
> build_mathvec=yes
> fi
>
> +if test x"$use_sframe" = xnotset ; then
> + use_sframe=yes
> +fi
> +
> test_enable_cet=$enable_cet
> if test $enable_cet != no; then
> # Check if CET can be enabled.
> diff --git a/sysdeps/x86_64/configure.ac b/sysdeps/x86_64/configure.ac
> index 4a3f7f4541..eabbee84cd 100644
> --- a/sysdeps/x86_64/configure.ac
> +++ b/sysdeps/x86_64/configure.ac
> @@ -21,6 +21,10 @@ if test x"$build_mathvec" = xnotset; then
> build_mathvec=yes
> fi
>
> +if test x"$use_sframe" = xnotset ; then
> + use_sframe=yes
> +fi
> +
> test_enable_cet=$enable_cet
> if test $enable_cet != no; then
> # Check if CET can be enabled.
More information about the Libc-alpha
mailing list