libbacktrace: handle MOREDATA correctly without debug info

Based on patch from Andi Kleen.

	* elf.c (elf_nodebug): Handle state->moredata.
	* fileline.c (backtrace_syminfo_to_full_callback): Remove
	incorrect comment about MOREDATA.
	(backtrace_syminfo_to_full_callback_moredata): New function.
	* internal.h (backtrace_syminfo_to_full_callback_moredata):
	Declare.
	* strippedtest.c: New file.
	* configure.ac: check whether objcopy supports --strip-debug.
	* Makefile.am (strippedtest_SOURCES): New variable.
	(strippedtest_CFLAGS, strippedtest_LDFLAGS): Likewise.
	(strippedtest_LDADD): Likewise.
	(check_PROGRAMS): Add strippedtest.
	(MAKETESTS): Add strippedtest_stripped
	(%_stripped): New rule.
	* configure, Makefile.in: Regenerate.
This commit is contained in:
Ian Lance Taylor
2026-09-01 15:17:39 -07:00
parent 3bd5a08e4f
commit 735c54d9dc
8 changed files with 438 additions and 86 deletions
Vendored
+35 -2
View File
@@ -649,6 +649,8 @@ USE_DSYMUTIL_FALSE
USE_DSYMUTIL_TRUE
HAVE_OBJCOPY_DEBUGLINK_FALSE
HAVE_OBJCOPY_DEBUGLINK_TRUE
HAVE_OBJCOPY_STRIPDEBUG_FALSE
HAVE_OBJCOPY_STRIPDEBUG_TRUE
READELF
OBJCOPY
HAVE_COMPRESSED_DEBUG_ZSTD_FALSE
@@ -11397,7 +11399,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
#line 11400 "configure"
#line 11402 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -11503,7 +11505,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
#line 11506 "configure"
#line 11508 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -13254,6 +13256,33 @@ $as_echo "no" >&6; }
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether objcopy supports --strip-debug" >&5
$as_echo_n "checking whether objcopy supports --strip-debug... " >&6; }
if ${libbacktrace_cv_objcopy_stripdebug+:} false; then :
$as_echo_n "(cached) " >&6
else
if test -n "${with_target_subdir}"; then
libbacktrace_cv_objcopy_stripdebug=no
elif ! test -n "${OBJCOPY}"; then
libbacktrace_cv_objcopy_stripdebug=no
elif ${OBJCOPY} --help | grep strip-debug >/dev/null 2>&1; then
libbacktrace_cv_objcopy_stripdebug=yes
else
libbacktrace_cv_objcopy_stripdebug=no
fi
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libbacktrace_cv_objcopy_stripdebug" >&5
$as_echo "$libbacktrace_cv_objcopy_stripdebug" >&6; }
if test "$libbacktrace_cv_objcopy_stripdebug" = yes; then
HAVE_OBJCOPY_STRIPDEBUG_TRUE=
HAVE_OBJCOPY_STRIPDEBUG_FALSE='#'
else
HAVE_OBJCOPY_STRIPDEBUG_TRUE='#'
HAVE_OBJCOPY_STRIPDEBUG_FALSE=
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether objcopy supports debuglink" >&5
$as_echo_n "checking whether objcopy supports debuglink... " >&6; }
if ${libbacktrace_cv_objcopy_debuglink+:} false; then :
@@ -13745,6 +13774,10 @@ if test -z "${HAVE_COMPRESSED_DEBUG_ZSTD_TRUE}" && test -z "${HAVE_COMPRESSED_DE
as_fn_error $? "conditional \"HAVE_COMPRESSED_DEBUG_ZSTD\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
fi
if test -z "${HAVE_OBJCOPY_STRIPDEBUG_TRUE}" && test -z "${HAVE_OBJCOPY_STRIPDEBUG_FALSE}"; then
as_fn_error $? "conditional \"HAVE_OBJCOPY_STRIPDEBUG\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
fi
if test -z "${HAVE_OBJCOPY_DEBUGLINK_TRUE}" && test -z "${HAVE_OBJCOPY_DEBUGLINK_FALSE}"; then
as_fn_error $? "conditional \"HAVE_OBJCOPY_DEBUGLINK\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5