From: Ian Lance Taylor <iant@golang.org>
To: gcc-patches <gcc-patches@gcc.gnu.org>
Subject: libbacktrace patch committed: Only test --build-id if supported
Date: Fri, 6 Jan 2023 09:42:19 -0800 [thread overview]
Message-ID: <CAOyqgcVfEK_Y1fQVHCZ=RGy3e_O5uYCa4cOhPm9aZGb1Q_9t_g@mail.gmail.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 460 bytes --]
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.
[-- Attachment #2: patch.txt --]
[-- Type: text/plain, Size: 1526 bytes --]
diff --git a/libbacktrace/Makefile.am b/libbacktrace/Makefile.am
index 047b573c29a..1c4ac2baeb6 100644
--- a/libbacktrace/Makefile.am
+++ b/libbacktrace/Makefile.am
@@ -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
diff --git a/libbacktrace/configure.ac b/libbacktrace/configure.ac
index d0a0475cfa8..28e3a688c24 100644
--- a/libbacktrace/configure.ac
+++ b/libbacktrace/configure.ac
@@ -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
reply other threads:[~2023-01-06 17:42 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CAOyqgcVfEK_Y1fQVHCZ=RGy3e_O5uYCa4cOhPm9aZGb1Q_9t_g@mail.gmail.com' \
--to=iant@golang.org \
--cc=gcc-patches@gcc.gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).