From patchwork Sat Mar 2 21:12:04 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ian Lance Taylor X-Patchwork-Id: 1907173 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=golang-org.20230601.gappssmtp.com header.i=@golang-org.20230601.gappssmtp.com header.a=rsa-sha256 header.s=20230601 header.b=R4CSL7OM; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=2620:52:3:1:0:246e:9693:128c; helo=server2.sourceware.org; envelope-from=gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=patchwork.ozlabs.org) Received: from server2.sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4TnHjM726Vz23fC for ; Sun, 3 Mar 2024 08:12:38 +1100 (AEDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id DCE03385841E for ; Sat, 2 Mar 2024 21:12:35 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-yb1-xb2c.google.com (mail-yb1-xb2c.google.com [IPv6:2607:f8b0:4864:20::b2c]) by sourceware.org (Postfix) with ESMTPS id 608733858CDB for ; Sat, 2 Mar 2024 21:12:16 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 608733858CDB Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=golang.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=golang.org ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 608733858CDB Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2607:f8b0:4864:20::b2c ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1709413939; cv=none; b=ooHt3cGS3QwT9lsOhZamq+2Aj6uvdKByWQMi/CJbU7/UwtA+CFzHda7FfjTFUDC+RJ3I4kHv9nYl2TpO/qOHrw8vN39Aaf5YINvBAfru3KzuB8lEf29a30iija/Xon9eEm07EprmnLbPcXfOFGGUWH6D8WwPNyjKk2BNfxcSsSM= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1709413939; c=relaxed/simple; bh=HX5LXh9gnKNhW51CnhKSbUdLLJZcoNKlc2q3MkKBqao=; h=DKIM-Signature:MIME-Version:From:Date:Message-ID:Subject:To; b=j13t4ndZ8tsyRkiSXB5DMRZbVWpUrDhD8syXGMpN9mt0waLX5FdNYhw6Qj3fhOkZ07WZ7ekdFGHVfGpKnX6ZlDg9fxL0YI1bTCKFgBi0krSmjDw6GGS8T2DAJ+8A1SBguvJx1izCpyjVu//5I/+wu7rwjcrGAQQA4fFw5p6IaNM= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-yb1-xb2c.google.com with SMTP id 3f1490d57ef6-dd02fb9a31cso42200276.3 for ; Sat, 02 Mar 2024 13:12:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=golang-org.20230601.gappssmtp.com; s=20230601; t=1709413935; x=1710018735; darn=gcc.gnu.org; h=to:subject:message-id:date:from:mime-version:from:to:cc:subject :date:message-id:reply-to; bh=LrC7xCR538/cGr5DN0wRDBIeFRxEo3opxzWZ9eiVxuY=; b=R4CSL7OMqoK2677BWSmRVfh9bwbCi3InDa29bmau48Q07DQyKWTcuAH92e+cbX6PsG SZLArP+VGfddzUM0SHVbrFwUFf0qTf8hd7KMYGBvFdMQmcpNHhfjMX5ylJhuRF89G1cB moGnBr6ssIrTH1eRnkbWyIFCcnAGbDLMfsZ0huJFUvggjczGIIffHUfUSwbIIgvtDiFI s5d+y0H35jbWttGolVVQGpYh3+tmYW9XMc02XffB7leNTQuDvb+NdL4Z0+eB/utA5M7F JcrhasS18SJrgbgn/2xx7zANpxDbazzksC4PHVvDtKlrFDt7GTnOoms4IUT6hnXJN+Dk nVdg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709413935; x=1710018735; h=to:subject:message-id:date:from:mime-version:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=LrC7xCR538/cGr5DN0wRDBIeFRxEo3opxzWZ9eiVxuY=; b=ui56FkjQuRqy+uOv7Bf6QyQWwUSwhnnga/cI4k+alxvNqwnuq5/m0jMV/d4GyAL/9T icfr7HBF4f10CQ3IakYNLUb2x1NlAs+ds9P7+K9pJT/TBtbP2zW5LnSSVTANXYMwlflh MaezodL0yCAhz/AqEjxj/LLZZVD3gKG4RrWNmWbmEzByT85xpxO3H3ZHcczBLfqE4JYQ lzpRiP1Cm7OTz8G5FTF9yeJkmd/n9wsHb/+2Upe/wWE8XMnjEbCVlcIkeRFFCJyY/JkB I+wYu4lssvn5pfMR7eA4gSByou1vZi/0JWpZWDuhKricoX2jfLFIOxX2jkMsn4zy/br1 Q1TQ== X-Gm-Message-State: AOJu0Yxc1KUZmtHs1RhO84qHAr6JqD4P7lU0XJQE8/VMbTvYAEuUxPSA ZXkU44zztD9/dr6UwvXPJ/5J8xfQs7KB9OO9/pvL1h49IKkv5zdYOuqeL4V/7Y999Nza+QqyLWK LgH/mVgiHOy1WWVDIT28CeUBNBWbwh88WHA26pxNwx1tBDo3qTec= X-Google-Smtp-Source: AGHT+IGVYD4NHcrwFKhO8d7PuevAFVWGJ9kvhBUD3v0MKFeJz3XDSftrNt2Ln0E5DYc5xqoDdhNgZSCeK4BoV/CynvA= X-Received: by 2002:a5b:146:0:b0:dcb:cdce:3902 with SMTP id c6-20020a5b0146000000b00dcbcdce3902mr4238902ybp.55.1709413935390; Sat, 02 Mar 2024 13:12:15 -0800 (PST) MIME-Version: 1.0 From: Ian Lance Taylor Date: Sat, 2 Mar 2024 13:12:04 -0800 Message-ID: Subject: libbacktrace patch committed: Link test programs with -no-install To: gcc-patches X-Spam-Status: No, score=-9.9 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE 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.30 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org Some of the libbacktrace tests link a program and then modify the debug info in some way. When configured with --enable-shared the linking, using libtool, generates a shell script. That causes the tests to fail because they can't modify the debug info of a shell script. This patch, originally by Jan Tojnar, pass the -no-install flag to libtool to avoid generating a shell script. Bootstrapped and ran libbacktrace tests on x86_64-pc-linux-gnu. Committed to mainline. Ian * Makefile.am (libbacktrace_testing_ldflags): Define. (*_LDFLAGS): Add $(libbacktrace_testing_ldflags) for test programs. * Makefile.in: Regenerate 9b0d218544cd1b12bf63792c70052d2970acc69b diff --git a/libbacktrace/Makefile.am b/libbacktrace/Makefile.am index 750ed80ed05..5677ecd8865 100644 --- a/libbacktrace/Makefile.am +++ b/libbacktrace/Makefile.am @@ -106,6 +106,10 @@ check_DATA = # Flags to use when compiling test programs. libbacktrace_TEST_CFLAGS = $(EXTRA_FLAGS) $(WARN_FLAGS) -g +# Flags to use when linking test programs. +# This avoids generating a shell script when configured with --enable-shared. +libbacktrace_testing_ldflags = -no-install + if USE_DSYMUTIL %.dSYM: % @@ -170,54 +174,63 @@ xcoff_%.c: xcoff.c test_elf_32_SOURCES = test_format.c testlib.c test_elf_32_CFLAGS = $(libbacktrace_TEST_CFLAGS) +test_elf_32_LDFLAGS = $(libbacktrace_testing_ldflags) test_elf_32_LDADD = libbacktrace_noformat.la elf_32.lo BUILDTESTS += test_elf_32 test_elf_64_SOURCES = test_format.c testlib.c test_elf_64_CFLAGS = $(libbacktrace_TEST_CFLAGS) +test_elf_64_LDFLAGS = $(libbacktrace_testing_ldflags) test_elf_64_LDADD = libbacktrace_noformat.la elf_64.lo BUILDTESTS += test_elf_64 test_macho_SOURCES = test_format.c testlib.c test_macho_CFLAGS = $(libbacktrace_TEST_CFLAGS) +test_macho_LDFLAGS = $(libbacktrace_testing_ldflags) test_macho_LDADD = libbacktrace_noformat.la macho.lo BUILDTESTS += test_macho test_xcoff_32_SOURCES = test_format.c testlib.c test_xcoff_32_CFLAGS = $(libbacktrace_TEST_CFLAGS) +test_xcoff_32_LDFLAGS = $(libbacktrace_testing_ldflags) test_xcoff_32_LDADD = libbacktrace_noformat.la xcoff_32.lo BUILDTESTS += test_xcoff_32 test_xcoff_64_SOURCES = test_format.c testlib.c test_xcoff_64_CFLAGS = $(libbacktrace_TEST_CFLAGS) +test_xcoff_64_LDFLAGS = $(libbacktrace_testing_ldflags) test_xcoff_64_LDADD = libbacktrace_noformat.la xcoff_64.lo BUILDTESTS += test_xcoff_64 test_pecoff_SOURCES = test_format.c testlib.c test_pecoff_CFLAGS = $(libbacktrace_TEST_CFLAGS) +test_pecoff_LDFLAGS = $(libbacktrace_testing_ldflags) test_pecoff_LDADD = libbacktrace_noformat.la pecoff.lo BUILDTESTS += test_pecoff test_unknown_SOURCES = test_format.c testlib.c test_unknown_CFLAGS = $(libbacktrace_TEST_CFLAGS) +test_unknown_LDFLAGS = $(libbacktrace_testing_ldflags) test_unknown_LDADD = libbacktrace_noformat.la unknown.lo BUILDTESTS += test_unknown unittest_SOURCES = unittest.c testlib.c unittest_CFLAGS = $(libbacktrace_TEST_CFLAGS) +unittest_LDFLAGS = $(libbacktrace_testing_ldflags) unittest_LDADD = libbacktrace.la BUILDTESTS += unittest unittest_alloc_SOURCES = $(unittest_SOURCES) unittest_alloc_CFLAGS = $(libbacktrace_TEST_CFLAGS) +unittest_alloc_LDFLAGS = $(libbacktrace_testing_ldflags) unittest_alloc_LDADD = libbacktrace_alloc.la BUILDTESTS += unittest_alloc @@ -253,7 +266,7 @@ if HAVE_OBJCOPY_DEBUGLINK b2test_SOURCES = $(btest_SOURCES) b2test_CFLAGS = $(libbacktrace_TEST_CFLAGS) -b2test_LDFLAGS = -Wl,--build-id +b2test_LDFLAGS = -Wl,--build-id $(libbacktrace_testing_ldflags) b2test_LDADD = libbacktrace_elf_for_test.la check_PROGRAMS += b2test @@ -263,7 +276,7 @@ if HAVE_DWZ b3test_SOURCES = $(btest_SOURCES) b3test_CFLAGS = $(libbacktrace_TEST_CFLAGS) -b3test_LDFLAGS = -Wl,--build-id +b3test_LDFLAGS = -Wl,--build-id $(libbacktrace_testing_ldflags) b3test_LDADD = libbacktrace_elf_for_test.la check_PROGRAMS += b3test @@ -277,6 +290,7 @@ endif HAVE_ELF btest_SOURCES = btest.c testlib.c btest_CFLAGS = $(libbacktrace_TEST_CFLAGS) -O +btest_LDFLAGS = $(libbacktrace_testing_ldflags) btest_LDADD = libbacktrace.la BUILDTESTS += btest @@ -289,6 +303,7 @@ if HAVE_ELF btest_lto_SOURCES = btest.c testlib.c btest_lto_CFLAGS = $(libbacktrace_TEST_CFLAGS) -O -flto +btest_lto_LDFLAGS = $(libbacktrace_testing_ldflags) btest_lto_LDADD = libbacktrace.la BUILDTESTS += btest_lto @@ -297,6 +312,7 @@ endif HAVE_ELF btest_alloc_SOURCES = $(btest_SOURCES) btest_alloc_CFLAGS = $(libbacktrace_TEST_CFLAGS) +btest_alloc_LDFLAGS = $(libbacktrace_testing_ldflags) btest_alloc_LDADD = libbacktrace_alloc.la BUILDTESTS += btest_alloc @@ -331,6 +347,7 @@ endif HAVE_DWZ stest_SOURCES = stest.c stest_CFLAGS = $(libbacktrace_TEST_CFLAGS) +stest_LDFLAGS = $(libbacktrace_testing_ldflags) stest_LDADD = libbacktrace.la BUILDTESTS += stest @@ -341,6 +358,7 @@ endif USE_DSYMUTIL stest_alloc_SOURCES = $(stest_SOURCES) stest_alloc_CFLAGS = $(libbacktrace_TEST_CFLAGS) +stest_alloc_LDFLAGS = $(libbacktrace_testing_ldflags) stest_alloc_LDADD = libbacktrace_alloc.la BUILDTESTS += stest_alloc @@ -353,6 +371,7 @@ if HAVE_ELF ztest_SOURCES = ztest.c testlib.c ztest_CFLAGS = $(libbacktrace_TEST_CFLAGS) -DSRCDIR=\"$(srcdir)\" +ztest_LDFLAGS = $(libbacktrace_testing_ldflags) ztest_LDADD = libbacktrace.la ztest_alloc_LDADD = libbacktrace_alloc.la @@ -367,11 +386,13 @@ BUILDTESTS += ztest ztest_alloc_SOURCES = $(ztest_SOURCES) ztest_alloc_CFLAGS = $(ztest_CFLAGS) +ztest_alloc_LDFLAGS = $(libbacktrace_testing_ldflags) BUILDTESTS += ztest_alloc zstdtest_SOURCES = zstdtest.c testlib.c zstdtest_CFLAGS = $(libbacktrace_TEST_CFLAGS) -DSRCDIR=\"$(srcdir)\" +zstdtest_LDFLAGS = $(libbacktrace_testing_ldflags) zstdtest_LDADD = libbacktrace.la zstdtest_alloc_LDADD = libbacktrace_alloc.la @@ -386,6 +407,7 @@ BUILDTESTS += zstdtest zstdtest_alloc_SOURCES = $(zstdtest_SOURCES) zstdtest_alloc_CFLAGS = $(zstdtest_CFLAGS) +zstdtest_alloc_LDFLAGS = $(libbacktrace_testing_ldflags) BUILDTESTS += zstdtest_alloc @@ -393,6 +415,7 @@ endif HAVE_ELF edtest_SOURCES = edtest.c edtest2_build.c testlib.c edtest_CFLAGS = $(libbacktrace_TEST_CFLAGS) +edtest_LDFLAGS = $(libbacktrace_testing_ldflags) edtest_LDADD = libbacktrace.la BUILDTESTS += edtest @@ -403,6 +426,7 @@ endif USE_DSYMUTIL edtest_alloc_SOURCES = $(edtest_SOURCES) edtest_alloc_CFLAGS = $(libbacktrace_TEST_CFLAGS) +edtest_alloc_LDFLAGS = $(libbacktrace_testing_ldflags) edtest_alloc_LDADD = libbacktrace_alloc.la if USE_DSYMUTIL @@ -423,6 +447,7 @@ BUILDTESTS += ttest ttest_SOURCES = ttest.c testlib.c ttest_CFLAGS = $(libbacktrace_TEST_CFLAGS) -pthread +ttest_LDFLAGS = $(libbacktrace_testing_ldflags) ttest_LDADD = libbacktrace.la if USE_DSYMUTIL @@ -433,6 +458,7 @@ BUILDTESTS += ttest_alloc ttest_alloc_SOURCES = $(ttest_SOURCES) ttest_alloc_CFLAGS = $(ttest_CFLAGS) +ttest_alloc_LDFLAGS = $(libbacktrace_testing_ldflags) ttest_alloc_LDADD = libbacktrace_alloc.la if USE_DSYMUTIL @@ -471,12 +497,12 @@ if HAVE_COMPRESSED_DEBUG ctestg_SOURCES = btest.c testlib.c ctestg_CFLAGS = $(libbacktrace_TEST_CFLAGS) -ctestg_LDFLAGS = -Wl,--compress-debug-sections=zlib-gnu +ctestg_LDFLAGS = -Wl,--compress-debug-sections=zlib-gnu $(libbacktrace_testing_ldflags) ctestg_LDADD = libbacktrace.la ctesta_SOURCES = btest.c testlib.c ctesta_CFLAGS = $(libbacktrace_TEST_CFLAGS) -ctesta_LDFLAGS = -Wl,--compress-debug-sections=zlib-gabi +ctesta_LDFLAGS = -Wl,--compress-debug-sections=zlib-gabi $(libbacktrace_testing_ldflags) ctesta_LDADD = libbacktrace.la BUILDTESTS += ctestg ctesta @@ -485,7 +511,7 @@ if HAVE_COMPRESSED_DEBUG_ZSTD ctestzstd_SOURCES = btest.c testlib.c ctestzstd_CFLAGS = $(libbacktrace_TEST_CFLAGS) -ctestzstd_LDFLAGS = -Wl,--compress-debug-sections=zstd +ctestzstd_LDFLAGS = -Wl,--compress-debug-sections=zstd $(libbacktrace_testing_ldflags) ctestzstd_LDADD = libbacktrace.la BUILDTESTS += ctestzstd @@ -494,12 +520,12 @@ endif ctestg_alloc_SOURCES = $(ctestg_SOURCES) ctestg_alloc_CFLAGS = $(ctestg_CFLAGS) -ctestg_alloc_LDFLAGS = $(ctestg_LDFLAGS) +ctestg_alloc_LDFLAGS = $(ctestg_LDFLAGS) $(libbacktrace_testing_ldflags) ctestg_alloc_LDADD = libbacktrace_alloc.la ctesta_alloc_SOURCES = $(ctesta_SOURCES) ctesta_alloc_CFLAGS = $(ctesta_CFLAGS) -ctesta_alloc_LDFLAGS = $(ctesta_LDFLAGS) +ctesta_alloc_LDFLAGS = $(ctesta_LDFLAGS) $(libbacktrace_testing_ldflags) ctesta_alloc_LDADD = libbacktrace_alloc.la BUILDTESTS += ctestg_alloc ctesta_alloc @@ -510,6 +536,7 @@ if HAVE_DWARF5 dwarf5_SOURCES = btest.c testlib.c dwarf5_CFLAGS = $(libbacktrace_TEST_CFLAGS) -gdwarf-5 +dwarf5_LDFLAGS = $(libbacktrace_testing_ldflags) dwarf5_LDADD = libbacktrace.la BUILDTESTS += dwarf5 @@ -520,6 +547,7 @@ endif USE_DSYMUTIL dwarf5_alloc_SOURCES = $(dwarf5_SOURCES) dwarf5_alloc_CFLAGS = $(dwarf5_CFLAGS) +dwarf5_alloc_LDFLAGS = $(libbacktrace_testing_ldflags) dwarf5_alloc_LDADD = libbacktrace_alloc.la BUILDTESTS += dwarf5_alloc @@ -532,6 +560,7 @@ endif mtest_SOURCES = mtest.c testlib.c mtest_CFLAGS = $(libbacktrace_TEST_CFLAGS) -O +mtest_LDFLAGS = $(libbacktrace_testing_ldflags) mtest_LDADD = libbacktrace.la BUILDTESTS += mtest @@ -564,10 +593,12 @@ if HAVE_ELF xztest_SOURCES = xztest.c testlib.c xztest_CFLAGS = $(libbacktrace_TEST_CFLAGS) -DSRCDIR=\"$(srcdir)\" +xztest_LDFLAGS = $(libbacktrace_testing_ldflags) xztest_LDADD = libbacktrace.la xztest_alloc_SOURCES = $(xztest_SOURCES) xztest_alloc_CFLAGS = $(xztest_CFLAGS) +xztest_alloc_LDFLAGS = $(libbacktrace_testing_ldflags) xztest_alloc_LDADD = libbacktrace_alloc.la if HAVE_LIBLZMA