aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom de Vries <tdevries@suse.de>2023-04-24 14:48:06 +0200
committerTom de Vries <tdevries@suse.de>2023-04-24 14:48:06 +0200
commitac3c4894cfbfc876fffd193ebf6f6ff55ef62318 (patch)
tree307de38063a59d32461f99d10b0396ecd7507558
parentddbc483e7dc2266296caff17990b5b896d15095f (diff)
downloadgdb-ac3c4894cfbfc876fffd193ebf6f6ff55ef62318.zip
gdb-ac3c4894cfbfc876fffd193ebf6f6ff55ef62318.tar.gz
gdb-ac3c4894cfbfc876fffd193ebf6f6ff55ef62318.tar.bz2
[gdb/testsuite] Fix gdb.multi/multi-arch.exp on powerpc64le
When running test-case gdb.multi/multi-arch.exp on powerpc64le-linux, I run into: ... Running gdb/testsuite/gdb.multi/multi-arch.exp ... gdb compile failed, In file included from /usr/include/features.h:399:0, from /usr/include/stdio.h:27, from gdb/testsuite/gdb.multi/hangout.c:18: /usr/include/gnu/stubs.h:8:27: fatal error: gnu/stubs-32.h: \ No such file or directory # include <gnu/stubs-32.h> ^ compilation terminated. ... The problem is that the test-case attempts to use gcc -m32 to produce an executable while that's not available. Fix this by: - introduce a new caching proc have_compile_and_link_flag, and - using have_compile_and_link_flag in test-case gdb.multi/multi-arch.exp. Tested on: - x86_64-linux (openSUSE Leap 15.4), and - powerpc64le-linux (CentOS-7).
-rw-r--r--gdb/testsuite/gdb.multi/multi-arch.exp8
-rw-r--r--gdb/testsuite/lib/gdb.exp8
2 files changed, 16 insertions, 0 deletions
diff --git a/gdb/testsuite/gdb.multi/multi-arch.exp b/gdb/testsuite/gdb.multi/multi-arch.exp
index f2c8a28..e1fbe1b 100644
--- a/gdb/testsuite/gdb.multi/multi-arch.exp
+++ b/gdb/testsuite/gdb.multi/multi-arch.exp
@@ -50,6 +50,14 @@ if [istarget "s390*-*-*"] {
set march2 "-m32"
}
+if { $march1 != "" } {
+ require "have_compile_and_link_flag $march1"
+}
+
+if { $march2 != "" } {
+ require "have_compile_and_link_flag $march2"
+}
+
if { [build_executable "failed to prepare" ${exec1} "${srcfile1}" \
[list debug additional_flags=${march1}]] } {
return -1
diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp
index 9d711e8..45588d8 100644
--- a/gdb/testsuite/lib/gdb.exp
+++ b/gdb/testsuite/lib/gdb.exp
@@ -9668,6 +9668,14 @@ gdb_caching_proc have_compile_flag { flag } {
additional_flags=$flag]
}
+# Return 1 if we can create an executable using compile and link flag FLAG.
+
+gdb_caching_proc have_compile_and_link_flag { flag } {
+ set src { int main () { return 0; } }
+ return [gdb_can_simple_compile have_compile_and_link_flag_$flag $src executable \
+ additional_flags=$flag]
+}
+
# Handle include file $srcdir/$subdir/FILE.
proc include_file { file } {