summaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/warn/weak1.C
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/g++.dg/warn/weak1.C')
-rw-r--r--gcc/testsuite/g++.dg/warn/weak1.C22
1 files changed, 22 insertions, 0 deletions
diff --git a/gcc/testsuite/g++.dg/warn/weak1.C b/gcc/testsuite/g++.dg/warn/weak1.C
new file mode 100644
index 000000000..8a50030bc
--- /dev/null
+++ b/gcc/testsuite/g++.dg/warn/weak1.C
@@ -0,0 +1,22 @@
+// { dg-do run }
+// { dg-require-weak "" }
+// The PA HP-UX and Tru64 UNIX dynamic loaders don't support unsatisfied
+// weak symbols.
+// { dg-skip-if "No unsat" { alpha*-dec-osf* hppa*-*-hpux* } { "*" } { "" } }
+// The darwin loader does, but they do need to exist at link time.
+// { dg-skip-if "No link unsat" { *-*-darwin* } { "*" } { "" } }
+// For kernel modules and static RTPs, the loader treats undefined weak
+// symbols in the same way as undefined strong symbols. The test
+// therefore fails to load, so skip it.
+// { dg-skip-if "" { "*-*-vxworks*" && nonpic } "*" { "-non-static" } }
+
+extern void foo (void) __attribute__ ((weak));
+
+int
+main ()
+{
+ if (&foo)
+ foo ();
+
+ return 0;
+}