Hi,
this patch introduces an effective target weak_undefined, and uses it in
test-case visibility-22.c.
I've tested this on trunk for x86_64, and the test still runs and passes.
I've tested this on an internal branch for the gcn target, where it
makes the test unsupported (instead of timing out due to random code
execution).
OK for trunk?
Thanks,
- Tom
Require effective target weak_undefined for visibility-22.c
2017-12-14 Tom de Vries <t...@codesourcery.com>
* lib/target-supports.exp (check_effective_target_weak_undefined): New
proc.
* gcc.dg/visibility-22.c: Require effective target weak_undefined.
---
gcc/testsuite/gcc.dg/visibility-22.c | 1 +
gcc/testsuite/lib/target-supports.exp | 9 +++++++++
2 files changed, 10 insertions(+)
diff --git a/gcc/testsuite/gcc.dg/visibility-22.c b/gcc/testsuite/gcc.dg/visibility-22.c
index 52f59be..49a95ce 100644
--- a/gcc/testsuite/gcc.dg/visibility-22.c
+++ b/gcc/testsuite/gcc.dg/visibility-22.c
@@ -1,6 +1,7 @@
/* PR target/32219 */
/* { dg-do run } */
/* { dg-require-visibility "" } */
+/* { dg-require-effective-target weak_undefined } */
/* { dg-options "-O2 -fPIC" { target fpic } } */
/* This test requires support for undefined weak symbols. This support
is not available on hppa*-*-hpux*. The test is skipped rather than
diff --git a/gcc/testsuite/lib/target-supports.exp b/gcc/testsuite/lib/target-supports.exp
index 9750b7a..227d8f6 100644
--- a/gcc/testsuite/lib/target-supports.exp
+++ b/gcc/testsuite/lib/target-supports.exp
@@ -328,6 +328,15 @@ proc check_weak_available { } {
}
}
+# return 1 if weak undefined symbols are supported.
+
+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; }
+ } ""]
+}
+
###############################
# proc check_weak_override_available { }
###############################