From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from gnu.wildebeest.org (gnu.wildebeest.org [45.83.234.184]) by sourceware.org (Postfix) with ESMTPS id C14613858D28 for ; Fri, 24 Mar 2023 23:58:33 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org C14613858D28 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=klomp.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=klomp.org Received: from csb.redhat.com (deer0x03.wildebeest.org [172.31.17.133]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by gnu.wildebeest.org (Postfix) with ESMTPSA id B25DD313AC9D; Sat, 25 Mar 2023 00:58:31 +0100 (CET) Received: by csb.redhat.com (Postfix, from userid 10916) id A1BCDEE3BC; Sat, 25 Mar 2023 00:58:31 +0100 (CET) From: Mark Wielaard To: debugedit@sourceware.org Cc: Mark Wielaard Subject: [PATCH 2/3] debuginfo: check whether compiler needs -fdebug-macro Date: Sat, 25 Mar 2023 00:58:06 +0100 Message-Id: <20230324235807.2335399-2-mark@klomp.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20230324235807.2335399-1-mark@klomp.org> References: <20230324235807.2335399-1-mark@klomp.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-3036.9 required=5.0 tests=BAYES_00,GIT_PATCH_0,JMQ_SPF_NEUTRAL,KAM_DMARC_STATUS,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 List-Id: Some compilers only generate a .debug_macro section when given the -fdebug_macro flag. Signed-off-by: Mark Wielaard --- configure.ac | 13 +++++++++++++ tests/atlocal.in | 1 + tests/debugedit.at | 6 +++--- 3 files changed, 17 insertions(+), 3 deletions(-) diff --git a/configure.ac b/configure.ac index c887aed..79803dc 100644 --- a/configure.ac +++ b/configure.ac @@ -135,6 +135,19 @@ else fi AC_SUBST([GZ_NONE_FLAG]) +AC_CACHE_CHECK([whether compiler needs -fdebug-macro], ac_cv_debug_macro, [dnl +save_CFLAGS="$CFLAGS" +CFLAGS="-fdebug-macro" +AC_LINK_IFELSE([AC_LANG_PROGRAM()], ac_cv_debug_macro=yes, ac_cv_debug_macro=no) +CFLAGS="$save_CFLAGS" +]) +if test "$ac_cv_debug_macro" = "yes"; then + DEBUG_MACRO_FLAG="-fdebug-macro" +else + DEBUG_MACRO_FLAG="" +fi +AC_SUBST([DEBUG_MACRO_FLAG]) + # And generate the output files. AC_CONFIG_FILES([Makefile]) AC_OUTPUT diff --git a/tests/atlocal.in b/tests/atlocal.in index d916301..01b998c 100644 --- a/tests/atlocal.in +++ b/tests/atlocal.in @@ -14,3 +14,4 @@ READELF="@READELF@" GDWARF_5_FLAG=@GDWARF_5_FLAG@ GZ_NONE_FLAG=@GZ_NONE_FLAG@ DWARF_5_DEBUGLINE=@DWARF_5_DEBUGLINE@ +DEBUG_MACRO_FLAG=@DEBUG_MACRO_FLAG@ diff --git a/tests/debugedit.at b/tests/debugedit.at index 0601127..19ab7dc 100644 --- a/tests/debugedit.at +++ b/tests/debugedit.at @@ -611,7 +611,7 @@ AT_CLEANUP # === AT_SETUP([debugedit .debug_macro objects]) AT_KEYWORDS([debuginfo] [debugedit]) -DEBUGEDIT_SETUP +DEBUGEDIT_SETUP([$DEBUG_MACRO_FLAG]) # We expect 3 for each compile unit. AT_DATA([expout], @@ -636,7 +636,7 @@ AT_CLEANUP # === AT_SETUP([debugedit .debug_macro partial]) AT_KEYWORDS([debuginfo] [debugedit]) -DEBUGEDIT_SETUP +DEBUGEDIT_SETUP([$DEBUG_MACRO_FLAG]) # We expect 3 for each compile unit. AT_DATA([expout], @@ -659,7 +659,7 @@ AT_CLEANUP # === AT_SETUP([debugedit .debug_macro exe]) AT_KEYWORDS([debuginfo] [debugedit]) -DEBUGEDIT_SETUP +DEBUGEDIT_SETUP([$DEBUG_MACRO_FLAG]) # We expect 3 for each compile unit. AT_DATA([expout], -- 2.31.1