[PATCH v2 2/5] tests/stack-fcall: use -gdwarf-aranges option if CC = clang

Masatake YAMATO yamato at redhat.com
Sun Nov 19 05:30:22 UTC 2023


* m4/st_debug_cflags.m4: New file defining a new macro
`st_DEBUG_CFLAGS' and a new condition `ACCEPT_GDWARF_ARANGES'.
* configure.ac: Use `st_DEBUG_CFLAGS'.
* tests/Makefile.am (stack_fcall_CFLAGS, stack_fcall_attach_CFLAGS):
set -gdwarf-aranges if the condtion `ACCEPT_GDWARF_ARANGES' is true.

Signed-off-by: Masatake YAMATO <yamato at redhat.com>
---
 configure.ac          |  1 +
 m4/st_debug_cflags.m4 | 14 ++++++++++++++
 tests/Makefile.am     | 10 ++++++++++
 3 files changed, 25 insertions(+)
 create mode 100644 m4/st_debug_cflags.m4

diff --git a/configure.ac b/configure.ac
index 21c7265bf..36fff9091 100644
--- a/configure.ac
+++ b/configure.ac
@@ -337,6 +337,7 @@ AC_DEFINE_UNQUOTED([ENABLE_ARM_OABI], [$enable_arm_oabi],
 		   [Define to 1 if you want OABI support on ARM EABI.])
 
 st_WARN_CFLAGS
+st_DEBUG_CFLAGS
 AX_PROG_CC_FOR_BUILD
 AM_PROG_AR
 
diff --git a/m4/st_debug_cflags.m4 b/m4/st_debug_cflags.m4
new file mode 100644
index 000000000..c70307dda
--- /dev/null
+++ b/m4/st_debug_cflags.m4
@@ -0,0 +1,14 @@
+#!/usr/bin/m4
+#
+# Copyright (c) 2023 The strace developers.
+# All rights reserved.
+#
+# SPDX-License-Identifier: LGPL-2.1-or-later
+
+AC_DEFUN([st_DEBUG_CFLAGS],[dnl
+gl_COMPILER_OPTION_IF([-gdwarf-aranges],
+                        [accept_dwarf_aranges_option=yes],
+			[accept_dwarf_aranges_option=no])
+AM_CONDITIONAL([ACCEPT_GDWARF_ARANGES],
+               [test ${accept_dwarf_aranges_option} = yes])
+])
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 5bec13c91..05f2e34dc 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -473,9 +473,19 @@ uio_CPPFLAGS = $(AM_CPPFLAGS) -D_FILE_OFFSET_BITS=64
 
 stack_fcall_SOURCES = stack-fcall.c \
 	stack-fcall-0.c stack-fcall-1.c stack-fcall-2.c stack-fcall-3.c
+if USE_LIBDW
+if ACCEPT_GDWARF_ARANGES
+stack_fcall_CFLAGS=-gdwarf-aranges
+endif
+endif
 
 stack_fcall_attach_SOURCES = stack-fcall-attach.c \
 	stack-fcall-0.c stack-fcall-1.c stack-fcall-2.c stack-fcall-3.c
+if USE_LIBDW
+if ACCEPT_GDWARF_ARANGES
+stack_fcall_attach_CFLAGS=-gdwarf-aranges
+endif
+endif
 
 stack_fcall_mangled_SOURCES = stack-fcall-mangled.c \
 	stack-fcall-mangled-0.c stack-fcall-mangled-1.c \
-- 
2.41.0



More information about the Strace-devel mailing list