libbacktrace patch committed: Only test --build-id if supported
Checks
Commit Message
PR 108297 points out that there are systems that use ELF but for which
the linker does not support the --build-id option. This libbacktrace
patch skips --build-id tests when it doesn't work. Bootstrapped and
ran libbacktrace tests on x86_64-pc-linux-gnu. Committed to mainline.
Ian
PR libbacktrace/108297
* configure.ac: Test whether linker supports --build-id.
* Makefile.am: Only run --build-id tests if supported.
* configure, Makefile.in: Regenerate.
@@ -248,6 +248,7 @@ check_DATA += allocfail.dSYM
endif USE_DSYMUTIL
if HAVE_ELF
+if HAVE_BUILDID
if HAVE_OBJCOPY_DEBUGLINK
b2test_SOURCES = $(btest_SOURCES)
@@ -271,6 +272,7 @@ MAKETESTS += b3test_dwz_buildid
endif HAVE_DWZ
endif HAVE_OBJCOPY_DEBUGLINK
+endif HAVE_BUILDID
endif HAVE_ELF
btest_SOURCES = btest.c testlib.c
@@ -484,7 +484,18 @@ AC_CHECK_LIB([z], [compress],
[AC_DEFINE(HAVE_ZLIB, 1, [Define if -lz is available.])])
AM_CONDITIONAL(HAVE_ZLIB, test "$ac_cv_lib_z_compress" = yes)
-dnl Test whether the linker supports the --compress_debug_sections option.
+dnl Test whether the linker supports the --build-id option.
+AC_CACHE_CHECK([whether --build-id is supported],
+[libbacktrace_cv_ld_buildid],
+[LDFLAGS_hold=$LDFLAGS
+LDFLAGS="$LDFLAGS -Wl,--build-id"
+AC_LINK_IFELSE([AC_LANG_PROGRAM(,)],
+[libbacktrace_cv_ld_buildid=yes],
+[libbacktrace_cv_ld_buildid=no])
+LDFLAGS=$LDFLAGS_hold])
+AM_CONDITIONAL(HAVE_BUILDID, test "$libbacktrace_cv_ld_buildid" = yes)
+
+dnl Test whether the linker supports the --compress-debug-sections option.
AC_CACHE_CHECK([whether --compress-debug-sections is supported],
[libgo_cv_ld_compress],
[LDFLAGS_hold=$LDFLAGS