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
+14
View File
@@ -560,6 +560,20 @@ AM_CONDITIONAL(HAVE_COMPRESSED_DEBUG_ZSTD, test "$libgo_cv_ld_compress_zstd" = y
AC_ARG_VAR(OBJCOPY, [location of objcopy])
AC_CHECK_PROG(OBJCOPY, objcopy, objcopy,)
AC_CHECK_PROG(READELF, readelf, readelf)
AC_CACHE_CHECK([whether objcopy supports --strip-debug],
[libbacktrace_cv_objcopy_stripdebug],
[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])
AM_CONDITIONAL(HAVE_OBJCOPY_STRIPDEBUG, test "$libbacktrace_cv_objcopy_stripdebug" = yes)
AC_CACHE_CHECK([whether objcopy supports debuglink],
[libbacktrace_cv_objcopy_debuglink],
[if test -n "${with_target_subdir}"; then