[PATCH 00/13] CTF dumper improvements, a lookup testsuite, and bugfixes
Nick Alcock
nick.alcock@oracle.com
Tue Jan 5 17:13:56 GMT 2021
On 5 Jan 2021, H. J. Lu via Binutils said:
> All libctf tests failed for cross binutils without a cross compiler:
>
> ERROR: aarch64-linux-cc does not exist
Ugh. It helps to actually *call* check_compiler_available as well as
just defining it. How did I miss that?
Unusurprisingly since we never called it it was a crawling mass of bugs
as well. :(
Try this (not really tested yet since I don't have a non-libctf-capable
compiler to hand right now, so I only know it works in the positive
case!):
If it works for you, I'll push it.
Sorry about this.
8<----------------------------------------------->8
>From 70d3120f32281980105169dee74440146e97702e Mon Sep 17 00:00:00 2001
From: Nick Alcock <nick.alcock@oracle.com>
Date: Tue, 5 Jan 2021 17:11:20 +0000
Subject: [PATCH] libctf, testsuite: don't run without a suitable compiler
We never actually check to see if the compiler supports CTF,
or even if a suitable compiler exists.
libctf/ChangeLog
2021-01-05 Nick Alcock <nick.alcock@oracle.com>
* Makefile.am (BASEDIR): New.
(BFDDIR): Likewise.
(check-DEJAGNU): Add development.exp to prerequisites.
(development.exp): New.
(CONFIG_STATUS_DEPENDENCIES): New.
(EXTRA_DEJAGNU_SITE_CONFIG): Likewise.
(DISTCLEANFILES): Likewise.
* Makefile.in: Regenerated.
* testsuite/lib/ctf-lib.exp (check_ctf_available): Return boolean.
* testsuite/libctf-lookup/lookup.exp: Call check_ctf_available.
* testsuite/libctf-regression/regression.exp: Likewise.
---
libctf/ChangeLog | 14 ++++++++++++++
libctf/Makefile.am | 15 ++++++++++++++-
libctf/Makefile.in | 14 +++++++++++++-
libctf/testsuite/lib/ctf-lib.exp | 7 ++++++-
libctf/testsuite/libctf-lookup/lookup.exp | 5 +++++
libctf/testsuite/libctf-regression/regression.exp | 5 +++++
6 files changed, 57 insertions(+), 3 deletions(-)
diff --git a/libctf/ChangeLog b/libctf/ChangeLog
index 0aaf3067ab6..0f5e96a2c83 100644
--- a/libctf/ChangeLog
+++ b/libctf/ChangeLog
@@ -1,3 +1,17 @@
+2021-01-05 Nick Alcock <nick.alcock@oracle.com>
+
+ * Makefile.am (BASEDIR): New.
+ (BFDDIR): Likewise.
+ (check-DEJAGNU): Add development.exp to prerequisites.
+ (development.exp): New.
+ (CONFIG_STATUS_DEPENDENCIES): New.
+ (EXTRA_DEJAGNU_SITE_CONFIG): Likewise.
+ (DISTCLEANFILES): Likewise.
+ * Makefile.in: Regenerated.
+ * testsuite/lib/ctf-lib.exp (check_ctf_available): Return boolean.
+ * testsuite/libctf-lookup/lookup.exp: Call check_ctf_available.
+ * testsuite/libctf-regression/regression.exp: Likewise.
+
2021-01-05 Nick Alcock <nick.alcock@oracle.com>
* ctf-types.c (ctf_type_aname): Print forwards to unions and enums
diff --git a/libctf/Makefile.am b/libctf/Makefile.am
index 3fe1994d96e..f45433483c0 100644
--- a/libctf/Makefile.am
+++ b/libctf/Makefile.am
@@ -27,6 +27,8 @@ AUTOMAKE_OPTIONS = dejagnu foreign no-texinfo.tex
ZLIB = @zlibdir@ -lz
ZLIBINC = @zlibinc@
+BASEDIR = $(srcdir)/..
+BFDDIR = $(BASEDIR)/bfd
INCDIR = $(srcdir)/../include
AM_CPPFLAGS = -D_GNU_SOURCE -I$(srcdir) -I$(srcdir)/../include -I$(srcdir)/../bfd -I../bfd @INCINTL@
AM_CFLAGS = -std=gnu99 @ac_libctf_warn_cflags@ @warn@ @c_warn@ @WARN_PEDANTIC@ @WERROR@ $(ZLIBINC)
@@ -75,7 +77,7 @@ CC_FOR_TARGET = ` \
fi; \
fi`
-check-DEJAGNU: site.exp
+check-DEJAGNU: site.exp development.exp
srcroot=`cd $(srcdir) && pwd`; export srcroot; \
r=`pwd`; export r; \
LC_ALL=C; export LC_ALL; \
@@ -87,3 +89,14 @@ check-DEJAGNU: site.exp
CC_FOR_HOST="$(CC)" LIBS="$(LIBS)" $(RUNTESTFLAGS); \
else echo "WARNING: could not find \`runtest'" 1>&2; :;\
fi
+
+development.exp: $(BFDDIR)/development.sh
+ $(EGREP) "(development|experimental)=" $(BFDDIR)/development.sh \
+ | $(AWK) -F= '{ print "set " $$1 " " $$2 }' > $@
+
+# development.sh is used to determine -Werror default.
+CONFIG_STATUS_DEPENDENCIES = $(BFDDIR)/development.sh
+
+EXTRA_DEJAGNU_SITE_CONFIG = development.exp
+
+DISTCLEANFILES = site.exp development.exp
diff --git a/libctf/Makefile.in b/libctf/Makefile.in
index c86ac7b2b68..d31d017c1f5 100644
--- a/libctf/Makefile.in
+++ b/libctf/Makefile.in
@@ -448,6 +448,8 @@ AUTOMAKE_OPTIONS = dejagnu foreign no-texinfo.tex
# case both are empty.
ZLIB = @zlibdir@ -lz
ZLIBINC = @zlibinc@
+BASEDIR = $(srcdir)/..
+BFDDIR = $(BASEDIR)/bfd
INCDIR = $(srcdir)/../include
AM_CPPFLAGS = -D_GNU_SOURCE -I$(srcdir) -I$(srcdir)/../include -I$(srcdir)/../bfd -I../bfd @INCINTL@
AM_CFLAGS = -std=gnu99 @ac_libctf_warn_cflags@ @warn@ @c_warn@ @WARN_PEDANTIC@ @WERROR@ $(ZLIBINC)
@@ -486,6 +488,11 @@ CC_FOR_TARGET = ` \
fi; \
fi`
+
+# development.sh is used to determine -Werror default.
+CONFIG_STATUS_DEPENDENCIES = $(BFDDIR)/development.sh
+EXTRA_DEJAGNU_SITE_CONFIG = development.exp
+DISTCLEANFILES = site.exp development.exp
all: config.h
$(MAKE) $(AM_MAKEFLAGS) all-am
@@ -1216,6 +1223,7 @@ clean-generic:
distclean-generic:
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
-test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
+ -test -z "$(DISTCLEANFILES)" || rm -f $(DISTCLEANFILES)
maintainer-clean-generic:
@echo "This command is intended for maintainers to use"
@@ -1319,7 +1327,7 @@ uninstall-am: uninstall-includeHEADERS uninstall-libLTLIBRARIES
.PRECIOUS: Makefile
-check-DEJAGNU: site.exp
+check-DEJAGNU: site.exp development.exp
srcroot=`cd $(srcdir) && pwd`; export srcroot; \
r=`pwd`; export r; \
LC_ALL=C; export LC_ALL; \
@@ -1332,6 +1340,10 @@ check-DEJAGNU: site.exp
else echo "WARNING: could not find \`runtest'" 1>&2; :;\
fi
+development.exp: $(BFDDIR)/development.sh
+ $(EGREP) "(development|experimental)=" $(BFDDIR)/development.sh \
+ | $(AWK) -F= '{ print "set " $$1 " " $$2 }' > $@
+
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:
diff --git a/libctf/testsuite/lib/ctf-lib.exp b/libctf/testsuite/lib/ctf-lib.exp
index 796342b96de..fe028122195 100644
--- a/libctf/testsuite/lib/ctf-lib.exp
+++ b/libctf/testsuite/lib/ctf-lib.exp
@@ -399,7 +399,12 @@ proc check_ctf_available { } {
set f [open $src "w"]
puts $f "int main() { return 0; }"
close $f
- set ctf_available_saved [compile_one_cc $src $output "-gt -c"]
+ set comp_output [compile_one_cc $src $output "-gt -c"]
+ if { $comp_output == ""} {
+ set ctf_available_saved 1
+ } else {
+ set ctf_available_saved 0
+ }
remote_file host delete $src
remote_file host delete $output
file delete $src
diff --git a/libctf/testsuite/libctf-lookup/lookup.exp b/libctf/testsuite/libctf-lookup/lookup.exp
index 51ad257c94f..84ff46ce4d8 100644
--- a/libctf/testsuite/libctf-lookup/lookup.exp
+++ b/libctf/testsuite/libctf-lookup/lookup.exp
@@ -23,6 +23,11 @@ if ![is_elf_format] {
return 0
}
+if {![check_ctf_available]} {
+ unsupported "no CTF format support in the compiler"
+ return 0
+}
+
if {[info exists env(LC_ALL)]} {
set old_lc_all $env(LC_ALL)
}
diff --git a/libctf/testsuite/libctf-regression/regression.exp b/libctf/testsuite/libctf-regression/regression.exp
index 51ad257c94f..605d96f57b7 100644
--- a/libctf/testsuite/libctf-regression/regression.exp
+++ b/libctf/testsuite/libctf-regression/regression.exp
@@ -18,6 +18,11 @@
# MA 02110-1301, USA.
#
+if {![check_ctf_available]} {
+ unsupported "no CTF format support in the compiler"
+ return 0
+}
+
if ![is_elf_format] {
unsupported "CTF needs bfd changes to be emitted on non-ELF"
return 0
--
2.29.2.250.g8336e49d6f.dirty
More information about the Binutils
mailing list