public inbox for debugedit@sourceware.org
 help / color / mirror / Atom feed
* [COMMITTED] tests: Check gcc accepts -gz=none before usage
@ 2021-03-24 23:29 Mark Wielaard
  0 siblings, 0 replies; only message in thread
From: Mark Wielaard @ 2021-03-24 23:29 UTC (permalink / raw)
  To: debugedit; +Cc: Mark Wielaard

commit 4f138 "tests: fix for toolchains producing compressed debug
sections" used -gz=none unconditionally to compile the test
binaries. But not all gcc versions support -gz.

Add a configure check for -gz=none. Set GZ_NONE_FLAG in
atlocal.in. Use it instead of -gz=none in debugedit.at.

Signed-off-by: Mark Wielaard <mark@klomp.org>
---
 configure.ac       | 13 +++++++++++++
 tests/atlocal.in   |  1 +
 tests/debugedit.at |  8 ++++----
 3 files changed, 18 insertions(+), 4 deletions(-)

diff --git a/configure.ac b/configure.ac
index b4bd749..1669b5d 100644
--- a/configure.ac
+++ b/configure.ac
@@ -83,6 +83,19 @@ CFLAGS="$save_CFLAGS"
 GDWARF_5_FLAG=$ac_cv_gdwarf_5
 AC_SUBST([GDWARF_5_FLAG])
 
+AC_CACHE_CHECK([whether gcc supports -gz=none], ac_cv_gz_none, [dnl
+save_CFLAGS="$CFLAGS"
+CFLAGS="-gz=none"
+AC_COMPILE_IFELSE([AC_LANG_SOURCE()], ac_cv_gz_none=yes, ac_cv_gz_none=no)
+CFLAGS="$save_CFLAGS"
+])
+if test "$ac_cv_gz_none" = "yes"; then
+  GZ_NONE_FLAG="-gz=none"
+else
+  GZ_NONE_FLAG=""
+fi
+AC_SUBST([GZ_NONE_FLAG])
+
 # And generate the output files.
 AC_CONFIG_FILES([Makefile])
 AC_OUTPUT
diff --git a/tests/atlocal.in b/tests/atlocal.in
index 1324898..8ca240d 100644
--- a/tests/atlocal.in
+++ b/tests/atlocal.in
@@ -3,3 +3,4 @@
 
 PATH=@abs_builddir@:@abs_top_builddir@:$top_srcdir:$srcdir:$PATH
 GDWARF_5_FLAG=@GDWARF_5_FLAG@
+GZ_NONE_FLAG=@GZ_NONE_FLAG@
diff --git a/tests/debugedit.at b/tests/debugedit.at
index 9e6606a..27d3e21 100644
--- a/tests/debugedit.at
+++ b/tests/debugedit.at
@@ -37,11 +37,11 @@ cp "${abs_srcdir}"/data/SOURCES/foobar.h subdir_headers
 cp "${abs_srcdir}"/data/SOURCES/baz.c .
 
 # First three object files (foo.o subdir_bar/bar.o and baz.o)
-gcc -g3 -gz=none -Isubdir_headers $1 -c subdir_foo/foo.c
+gcc -g3 $GZ_NONE_FLAG -Isubdir_headers $1 -c subdir_foo/foo.c
 cd subdir_bar
-gcc -g3 -gz=none -I../subdir_headers $1 -c bar.c
+gcc -g3 $GZ_NONE_FLAG -I../subdir_headers $1 -c bar.c
 cd ..
-gcc -g3 -gz=none -I$(pwd)/subdir_headers $1 -c $(pwd)/baz.c
+gcc -g3 $GZ_NONE_FLAG -I$(pwd)/subdir_headers $1 -c $(pwd)/baz.c
 
 # Then a partially linked object file (somewhat like a kernel module).
 # This will still have relocations between the debug sections.
@@ -49,7 +49,7 @@ ld -r -o foobarbaz.part.o foo.o subdir_bar/bar.o baz.o
 
 # Create an executable. Relocations between debug sections will
 # have been resolved.
-gcc -g3 -gz=none -o foobarbaz.exe foo.o subdir_bar/bar.o baz.o
+gcc -g3 $GZ_NONE_FLAG -o foobarbaz.exe foo.o subdir_bar/bar.o baz.o
 ]])
 
 # ===
-- 
2.20.1


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2021-03-24 23:38 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-24 23:29 [COMMITTED] tests: Check gcc accepts -gz=none before usage Mark Wielaard

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).