From: Mark Wielaard <mark@klomp.org>
To: debugedit@sourceware.org
Cc: Mark Wielaard <mark@klomp.org>
Subject: [PATCH 2/3] debuginfo: check whether compiler needs -fdebug-macro
Date: Sat, 25 Mar 2023 00:58:06 +0100 [thread overview]
Message-ID: <20230324235807.2335399-2-mark@klomp.org> (raw)
In-Reply-To: <20230324235807.2335399-1-mark@klomp.org>
Some compilers only generate a .debug_macro section when given the
-fdebug_macro flag.
Signed-off-by: Mark Wielaard <mark@klomp.org>
---
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
next prev parent reply other threads:[~2023-03-24 23:58 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-03-24 23:58 [PATCH 1/3] debugedit: skip .debug_types tests if compiler doesn't generate section Mark Wielaard
2023-03-24 23:58 ` Mark Wielaard [this message]
2023-03-24 23:58 ` [PATCH 3/3] debugedit: Simplify and extend .debug_line tests Mark Wielaard
2023-03-25 11:30 ` [PATCH 1/3] debugedit: skip .debug_types tests if compiler doesn't generate section Dmitry V. Levin
2023-03-28 11:24 ` Mark Wielaard
2023-04-21 12:46 ` Mark Wielaard
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=20230324235807.2335399-2-mark@klomp.org \
--to=mark@klomp.org \
--cc=debugedit@sourceware.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).