1
0
mirror of https://sourceware.org/git/glibc.git synced 2025-08-08 17:42:12 +03:00

Disable SFrame support by default

And add extra checks to enable for binutils 2.45 and if the architecture
explicitly enables it.  When SFrame is disabled, all the related code
is also not enabled for backtrace() and _dl_find_object(), so SFrame
backtracking is not used even if the binary has the SFrame segment.

This patch also adds some other related fixes:

  * Fixed an issue with AC_CHECK_PROG_VER, where the READELF_SFRAME
    usage prevented specifying a different readelf through READELF
    environment variable at configure time.

  * Add an extra arch-specific internal definition,
    libc_cv_support_sframe, to disable --enable-sframe on architectures
    that have binutils but not glibc support (s390x).

  * Renamed the tests without the .sframe segment and move the
    tst-backtrace1 from pthread to debug.

  * Use the built compiler strip to remove the .sframe segment,
    instead of the system one (which might not support SFrame).

Checked on x86_64-linux-gnu and aarch64-linux-gnu.

Reviewed-by: Sam James <sam@gentoo.org>
This commit is contained in:
Adhemerval Zanella
2025-07-23 10:47:23 -03:00
committed by Andreas K. Hüttel
parent ce488f7c16
commit a12d72019e
17 changed files with 141 additions and 88 deletions

View File

@@ -194,3 +194,5 @@ if test $build_mathvec = no; then
printf "%s\n" "$as_me: WARNING: mathvec is disabled, this results in incomplete ABI." >&2;}
fi
libc_cv_support_sframe=yes

View File

@@ -31,3 +31,5 @@ fi
if test $build_mathvec = no; then
AC_MSG_WARN([mathvec is disabled, this results in incomplete ABI.])
fi
libc_cv_support_sframe=yes

View File

@@ -21,7 +21,9 @@ CFLAGS-wordcopy.c += -Wno-uninitialized
endif
ifeq ($(subdir),elf)
ifeq ($(enable-gsframe),yes)
sysdep_routines += sframe-read sframe
endif
ifeq (yes:yes,$(build-shared):$(unwind-find-fde))
# This is needed to support g++ v2 and v3.
sysdep_routines += framestate unwind-pe

View File

@@ -62,7 +62,6 @@ tests += \
tst-abstime \
tst-atfork1 \
tst-attr1 \
tst-backtrace1 \
tst-bad-schedattr \
tst-barrier1 \
tst-barrier2 \

View File

@@ -1,84 +0,0 @@
/* Copyright (C) 2004-2025 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see
<https://www.gnu.org/licenses/>. */
#include <execinfo.h>
#include <pthread.h>
#include <stdio.h>
#define BT_SIZE 64
void *bt_array[BT_SIZE];
int bt_cnt;
int
do_bt (void)
{
bt_cnt = backtrace (bt_array, BT_SIZE);
return 56;
}
int
call_do_bt (void)
{
return do_bt () + 1;
}
void *
tf (void *arg)
{
if (call_do_bt () != 57)
return (void *) 1L;
return NULL;
}
int
do_test (void)
{
pthread_t th;
if (pthread_create (&th, NULL, tf, NULL))
{
puts ("create failed");
return 1;
}
void *res;
if (pthread_join (th, &res))
{
puts ("join failed");
return 1;
}
if (res != NULL)
{
puts ("thread failed");
return 1;
}
char **text = backtrace_symbols (bt_array, bt_cnt);
if (text == NULL)
{
puts ("backtrace_symbols failed");
return 1;
}
for (int i = 0; i < bt_cnt; ++i)
puts (text[i]);
return 0;
}
#define TEST_FUNCTION do_test ()
#include "../test-skeleton.c"

View File

@@ -289,6 +289,8 @@ fi
config_vars="$config_vars
have-x86-apx = $libc_cv_x86_have_apx"
libc_cv_support_sframe=yes
test -n "$critic_missing" && as_fn_error $? "
*** $critic_missing" "$LINENO" 5

View File

@@ -104,5 +104,7 @@ if test $libc_cv_x86_have_apx = yes; then
fi
LIBC_CONFIG_VAR([have-x86-apx], [$libc_cv_x86_have_apx])
libc_cv_support_sframe=yes
test -n "$critic_missing" && AC_MSG_ERROR([
*** $critic_missing])