This change fixes the libbacktrace test suite on hppa64-hp-hpux11.11. Okay?
Dave --- libbacktrace: Check linker support for -Wl,-Bstatic in strippedtest [PR127312] On targets utilizing a proprietary linker that does not understand GNU linker options (such as hppa64-hp-hpux11.11), the hardcoded use of '-Wl,-Bstatic' in the strippedtest link flags causes a fatal linkage failure and halts the check suite. This patch fixes the issue by introducing a new autoconf feature check 'libbacktrace_cv_linker_bstatic' to dynamically verify if the target linker supports the '-Wl,-Bstatic' directive. The result is substituted via BSTATIC_LDFLAG, allowing the strippedtest link properties in Makefile.am to adapt cleanly across both GNU and HP-UX host linkers. 2026-10-28 John David Anglin <[email protected]> libbacktrace/ChangeLog: PR libbacktrace/127312 * configure.ac: Add a link-time feature check for -Wl,-Bstatic support and define the BSTATIC_LDFLAG substitution variable. * Makefile.am (strippedtest_LDFLAGS): Substitute hardcoded -Wl,-Bstatic with $(BSTATIC_LDFLAG). * configure, Makefile.in: Regenerate. diff --git a/libbacktrace/Makefile.am b/libbacktrace/Makefile.am index aa87e31a074..b379dcb7ae1 100644 --- a/libbacktrace/Makefile.am +++ b/libbacktrace/Makefile.am @@ -137,7 +137,7 @@ if HAVE_OBJCOPY_STRIPDEBUG strippedtest_SOURCES = strippedtest.c testlib.c strippedtest_CFLAGS = $(libbacktrace_TEST_CFLAGS) -O -strippedtest_LDFLAGS = $(libbacktrace_testing_ldflags) -static -Wl,-Bstatic +strippedtest_LDFLAGS = $(libbacktrace_testing_ldflags) -static $(BSTATIC_LDFLAG) strippedtest_LDADD = libbacktrace.la check_PROGRAMS += strippedtest diff --git a/libbacktrace/configure.ac b/libbacktrace/configure.ac index 90401e95768..e3e23247ff5 100644 --- a/libbacktrace/configure.ac +++ b/libbacktrace/configure.ac @@ -523,6 +523,22 @@ AC_LINK_IFELSE([AC_LANG_PROGRAM(,)], LDFLAGS=$LDFLAGS_hold]) AM_CONDITIONAL(HAVE_BUILDID, test "$libbacktrace_cv_ld_buildid" = yes) +# Check if the linker supports -Wl,-Bstatic for checking stripped object states. +AC_CACHE_CHECK([whether the linker supports -Wl,-Bstatic], + [libbacktrace_cv_linker_bstatic], + [save_LDFLAGS="$LDFLAGS" + LDFLAGS="$LDFLAGS -Wl,-Bstatic" + AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[]])], + [libbacktrace_cv_linker_bstatic=yes], + [libbacktrace_cv_linker_bstatic=no]) + LDFLAGS="$save_LDFLAGS"]) + +BSTATIC_LDFLAG="" +if test "x$libbacktrace_cv_linker_bstatic" = xyes; then + BSTATIC_LDFLAG="-Wl,-Bstatic" +fi +AC_SUBST(BSTATIC_LDFLAG) + dnl Test whether the linker supports the --compress-debug-sections=zlib-gnu dnl option. AC_CACHE_CHECK([whether --compress-debug-sections=zlib-gnu is supported],
signature.asc
Description: PGP signature
