aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/lib
diff options
context:
space:
mode:
authorAlexandre Oliva <oliva@adacore.com>2023-03-23 00:45:05 -0300
committerAlexandre Oliva <oliva@gnu.org>2023-03-24 01:14:30 -0300
commit378ec7b87a5265dbe2d489c245fac98ef37fa638 (patch)
tree3acd00b204f616c57c61eff2272763908d831c53 /gcc/testsuite/lib
parent3b67db31236631432e7f6d74ed49af9ae2183a4d (diff)
downloadgcc-378ec7b87a5265dbe2d489c245fac98ef37fa638.zip
gcc-378ec7b87a5265dbe2d489c245fac98ef37fa638.tar.gz
gcc-378ec7b87a5265dbe2d489c245fac98ef37fa638.tar.bz2
[testsuite] test for weak_undefined support and add options
A number of tests that depend on weak undefined symbols fail to require that support, and arrange to skip some targets and add special options to others on a test-by-test basis. Fix this by stating the requirement explicitly, and adding a proc to return any required options. Others rely on weak undefined symbols only to test for the availability of posix_memalign. Drop that in favor of dg effective target support for posix_memalign. for gcc/ChangeLog * doc/sourcebuild.texi (weak_undefined, posix_memalign): Document options and effective targets. for gcc/testsuite/ChangeLog * lib/target-supports.exp (add_options_for_weak_undefined): New. (check_effective_target_weak_undefined): Use it. (check_effective_target_posix_memalign): New. * gcc.dg/torture/pr53922.c: Drop skips and custom options in favor of effective target requirement and added options for weak_undefined symbols. * gcc.dg/torture/pr90020.c: Likewise. * gcc.dg/addr_equal-1.c: Likewise. * gcc.target/aarch64/aapcs64/aapcs64.exp: Likewise, for abitest.S-using tests. * gcc.dg/torture/pr60092.c: Likewise, but in favor of posix_memalign tests. * gcc.dg/vect/vect-tail-nomask-1.c: Likewise.
Diffstat (limited to 'gcc/testsuite/lib')
-rw-r--r--gcc/testsuite/lib/target-supports.exp28
1 files changed, 25 insertions, 3 deletions
diff --git a/gcc/testsuite/lib/target-supports.exp b/gcc/testsuite/lib/target-supports.exp
index 932aa5b..8a110f2 100644
--- a/gcc/testsuite/lib/target-supports.exp
+++ b/gcc/testsuite/lib/target-supports.exp
@@ -356,6 +356,18 @@ proc check_weak_available { } {
}
}
+# return options to add to enable weak undefined symbols.
+
+proc add_options_for_weak_undefined { flags } {
+ if { [istarget *-*-darwin*] } {
+ lappend flags "-Wl,-undefined,dynamic_lookup"
+ if { [istarget *-*-darwin[89]*] } {
+ lappend flags "-Wl,-flat_namespace"
+ }
+ }
+ return $flags
+}
+
# return 1 if weak undefined symbols are supported.
proc check_effective_target_weak_undefined { } {
@@ -365,7 +377,7 @@ proc check_effective_target_weak_undefined { } {
return [check_runtime weak_undefined {
extern void foo () __attribute__((weak));
int main (void) { if (foo) return 1; return 0; }
- } ""]
+ } [add_options_for_weak_undefined ""]]
}
###############################
@@ -1154,6 +1166,16 @@ proc check_effective_target_clone {} {
return [check_function_available "clone"]
}
+# Return 1 if the target supports posix_memalign, 0 otherwise.
+proc check_effective_target_posix_memalign {} {
+ if { [istarget *-*-vxworks*] } {
+ # VxWorks doesn't have posix_memalign but our way to test
+ # can't tell as we're doing partial links for kernel modules.
+ return 0
+ }
+ return [check_function_available "posix_memalign"]
+}
+
# Return 1 if the target supports setrlimit, 0 otherwise.
proc check_effective_target_setrlimit {} {
# Darwin has non-posix compliant RLIMIT_AS
@@ -2891,7 +2913,7 @@ proc check_fork_available {} {
# VxWorks doesn't have fork but our way to test can't
# tell as we're doing partial links for kernel modules.
return 0
- }
+ }
if { [istarget cris-*-*] } {
# Compiling and linking works, and an executable running e.g.
# gcc.dg/torture/ftrapv-1.c works on now-historical hardware,
@@ -10836,7 +10858,7 @@ proc check_vect_support_and_set_flags { } {
} else {
set dg-do-what-default compile
}
- } elseif [istarget "aarch64*-*-*"] {
+ } elseif [istarget aarch64*-*-*] {
set dg-do-what-default run
} elseif [istarget s390*-*-*] {
# The S/390 backend set a default of 2 for that value.