From patchwork Fri Jan 6 17:42:19 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ian Lance Taylor X-Patchwork-Id: 40213 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4e01:0:0:0:0:0 with SMTP id p1csp944367wrt; Fri, 6 Jan 2023 09:43:16 -0800 (PST) X-Google-Smtp-Source: AMrXdXvVkwFKcI1h6/Lq5SOx6V1xKllUMTSoNTsYEV39RkIJqwDTIkXUSeI0kZ6QjPgPOBVsSpYR X-Received: by 2002:a17:907:c007:b0:7ad:f165:70c2 with SMTP id ss7-20020a170907c00700b007adf16570c2mr66222093ejc.27.1673026996332; Fri, 06 Jan 2023 09:43:16 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673026996; cv=none; d=google.com; s=arc-20160816; b=vbS8JvZpg4kGPb5LXDdWVt7k5kjTaj7+uujmEa8tANHiUpT13zIyrQT0r4gZqBQGgY MA9PJVH1y9RTC+phgGNQ9QSfN3RhP3uYgrw0pTmh+sM7hr4g7mpeBuotIHgBXOT8I5ps bNLz49ovdONQDcfNrKc23CgQmBfuBkU6DHgUCaMUFl7rFeTnAruW7EYbg5CNYXT0osmk E/dCI/GNzh/qrz/PtOZuYLQ9K/khGtcO+BgZ/VRbec4oDM91qfpaVvmplWft+F2/ZfCM EI418+wRTmglAnITJxzzJQsNvSU5PVs0dXzS4yRYLJGH6+6ULPd25p8dHk58HAlR1qAv l/mQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:reply-to:from:list-subscribe:list-help:list-post :list-archive:list-unsubscribe:list-id:precedence:to:subject :message-id:date:mime-version:dmarc-filter:delivered-to :dkim-signature:dkim-filter; bh=ZooyaLYvWeaqLSzfNKiFL9QRuZbubWiHpSzWugGXzhM=; b=oZoHpBdQwtO6nbROZUBGsBilvrDVKZd65zcFZFJdXjUnPe3t7nRnMxTmf4yqsvaqpY eFCYd+Q6KmyDD90sHxL7sQZoE951seM7TE/hBzvr2MVhRQykyh0shybmn30ehS3Z+80m 37TSfD1mmY9GBp8KECyteSI0SsrfevPrP307Ay5AMcY+LyjFfHmBFq0PY85htlmlSW1x 6m5BOEYOxfX4yefqyF9aRlaD0Ll3o+4bhK59Pf3CDtTnrfRH4mmgE7+EsEl7Hahq1SxW UGLjDcgC8dxpdPvL4XRO7mMTCg7VuPB7K/NHLwt0R6viBh9JLcUFcjBo3lkOH4vTQ8Dx /YOA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=aqeMxcwp; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from sourceware.org (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id sg41-20020a170907a42900b007c10b655909si1915882ejc.251.2023.01.06.09.43.16 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 06 Jan 2023 09:43:16 -0800 (PST) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) client-ip=2620:52:3:1:0:246e:9693:128c; Authentication-Results: mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=aqeMxcwp; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 1B3F83858408 for ; Fri, 6 Jan 2023 17:43:15 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 1B3F83858408 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1673026995; bh=ZooyaLYvWeaqLSzfNKiFL9QRuZbubWiHpSzWugGXzhM=; h=Date:Subject:To:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=aqeMxcwpKsgAaxDml1U0GSVRoNFkcRaTtUa2kSO98QaUjTN3TuFvFSH6ekRfFSzOX zM+FENnF9pc8GYp8WvJwuRaKK/RMDIVWqFJS3VxnttnYBGGcDLAzFva/dx+CBpIb05 /9l1sFuf6jEshfHJCm5GPSez+s80uab8Y87sMWAY= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-pj1-x1033.google.com (mail-pj1-x1033.google.com [IPv6:2607:f8b0:4864:20::1033]) by sourceware.org (Postfix) with ESMTPS id E74463858408 for ; Fri, 6 Jan 2023 17:42:31 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org E74463858408 Received: by mail-pj1-x1033.google.com with SMTP id gq18so1989121pjb.2 for ; Fri, 06 Jan 2023 09:42:31 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=to:subject:message-id:date:from:mime-version:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=ZooyaLYvWeaqLSzfNKiFL9QRuZbubWiHpSzWugGXzhM=; b=M8bwj/niACaJxIGL832uZBlfqmSl6BISDp2FTFtIpMtPnA9fgzaFBOOyVIOYH1rQyg zrCjRRsFjAnGVPbs42P1jYpxu5yjQbzHDwtXBoidmqa2fGjrikSTo3YmsCUFrO0coLMy nJGLEQ9gWtRldMjcppM82/lGBzVm9QCezmHP8H9Zy9FZk76nUZwFtdG+Sc6ksfZJtItZ lmHCSK8i+kswAxg1urcdhf3VqxfmhxJPvZ5mnRN4bXVyASkQ3d3WyfbBZCo/ujIWPChj 13az5N5FbZQ7whD/HD5hnSUxLq7mONUSn2E5rDZVH4gU9SX0Rcnxi9wPfLTM2phQhWYY tDLg== X-Gm-Message-State: AFqh2krem4sVXYpjqafqaC7jMp8Ev1nhYaNGJD0AQM/CZeN87syqevQs hvEkzLH8GBGnhc+tIhSC3MIzqhNaI0wlXIpjszJ/intcejKZ/ogk X-Received: by 2002:a17:903:1304:b0:192:77a2:13fc with SMTP id iy4-20020a170903130400b0019277a213fcmr3083924plb.114.1673026950218; Fri, 06 Jan 2023 09:42:30 -0800 (PST) MIME-Version: 1.0 Date: Fri, 6 Jan 2023 09:42:19 -0800 Message-ID: Subject: libbacktrace patch committed: Only test --build-id if supported To: gcc-patches X-Spam-Status: No, score=-10.0 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Ian Lance Taylor via Gcc-patches From: Ian Lance Taylor Reply-To: Ian Lance Taylor Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org Sender: "Gcc-patches" X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1754295955612292837?= X-GMAIL-MSGID: =?utf-8?q?1754295955612292837?= 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. 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