summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/weak/weak-5.c
diff options
context:
space:
mode:
authorupstream source tree <ports@midipix.org>2015-03-15 20:14:05 -0400
committerupstream source tree <ports@midipix.org>2015-03-15 20:14:05 -0400
commit554fd8c5195424bdbcabf5de30fdc183aba391bd (patch)
tree976dc5ab7fddf506dadce60ae936f43f58787092 /gcc/testsuite/gcc.dg/weak/weak-5.c
downloadcbb-gcc-4.6.4-554fd8c5195424bdbcabf5de30fdc183aba391bd.tar.bz2
cbb-gcc-4.6.4-554fd8c5195424bdbcabf5de30fdc183aba391bd.tar.xz
obtained gcc-4.6.4.tar.bz2 from upstream website;upstream
verified gcc-4.6.4.tar.bz2.sig; imported gcc-4.6.4 source tree from verified upstream tarball. downloading a git-generated archive based on the 'upstream' tag should provide you with a source tree that is binary identical to the one extracted from the above tarball. if you have obtained the source via the command 'git clone', however, do note that line-endings of files in your working directory might differ from line-endings of the respective files in the upstream repository.
Diffstat (limited to 'gcc/testsuite/gcc.dg/weak/weak-5.c')
-rw-r--r--gcc/testsuite/gcc.dg/weak/weak-5.c109
1 files changed, 109 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.dg/weak/weak-5.c b/gcc/testsuite/gcc.dg/weak/weak-5.c
new file mode 100644
index 000000000..e82792af3
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/weak/weak-5.c
@@ -0,0 +1,109 @@
+/* { dg-do compile } */
+/* { dg-require-weak "" } */
+/* { dg-require-alias "" } */
+/* { dg-options "-fno-common" } */
+
+/* { dg-final { scan-assembler "weak\[^ \t\]*\[ \t\]_?vfoo1a" } } */
+/* { dg-final { scan-assembler "weak\[^ \t\]*\[ \t\]_?vfoo1b" } } */
+/* { dg-final { scan-assembler "weak\[^ \t\]*\[ \t\]_?vfoo1c" } } */
+/* { dg-final { scan-assembler "weak\[^ \t\]*\[ \t\]_?vfoo1d" } } */
+/* { dg-final { scan-assembler "weak\[^ \t\]*\[ \t\]_?vfoo1e" } } */
+/* { dg-final { scan-assembler "weak\[^ \t\]*\[ \t\]_?vfoo1f" } } */
+/* { dg-final { scan-assembler "weak\[^ \t\]*\[ \t\]_?vfoo1g" } } */
+/* { dg-final { scan-assembler "weak\[^ \t\]*\[ \t\]_?vfoo1h" } } */
+/* { dg-final { scan-assembler "weak\[^ \t\]*\[ \t\]_?vfoo1i" } } */
+/* { dg-final { scan-assembler "weak\[^ \t\]*\[ \t\]_?vfoo1j" } } */
+/* { dg-final { scan-assembler "weak\[^ \t\]*\[ \t\]_?vfoo1k" } } */
+/* { dg-final { scan-assembler "weak\[^ \t\]*\[ \t\]_?vfoo1l" } } */
+
+/* test variable addresses with __attribute__ ((weak)) */
+
+extern int vfoo1a __attribute__((weak));
+extern int vfoo1a;
+void * foo1a (void)
+{
+ return (void *)&vfoo1a;
+}
+
+
+extern int vfoo1b;
+extern int vfoo1b __attribute__((weak));
+void * foo1b (void)
+{
+ return (void *)&vfoo1b;
+}
+
+
+extern int vfoo1c;
+void * foo1c (void)
+{
+ return (void *)&vfoo1c;
+}
+extern int vfoo1c __attribute__((weak));
+
+
+extern int vfoo1d __attribute__((weak));
+int vfoo1d;
+void * foo1d (void)
+{
+ return (void *)&vfoo1d;
+}
+
+
+int vfoo1e;
+extern int vfoo1e __attribute__((weak));
+void * foo1e (void)
+{
+ return (void *)&vfoo1e;
+}
+
+
+int vfoo1f;
+void * foo1f (void)
+{
+ return (void *)&vfoo1f;
+}
+extern int vfoo1f __attribute__((weak));
+
+
+extern int vfoo1g;
+void * foo1g (void)
+{
+ return (void *)&vfoo1g;
+}
+int vfoo1g __attribute__((weak));
+
+
+extern int vfoo1h __attribute__((weak));
+void * foo1h (void)
+{
+ return (void *)&vfoo1h;
+}
+extern int vfoo1h __attribute__((weak));
+int vfoo1h;
+
+
+extern int vfoo1i __attribute__((weak));
+void * foo1i (void)
+{
+ return (void *)&vfoo1i;
+}
+extern int vfoo1i __attribute__((weak));
+extern int vfoo1i;
+
+
+extern int vfoo1j __attribute__((weak));
+void * foo1j (void)
+{
+ return (void *)&vfoo1j;
+}
+extern int vfoo1j;
+extern int vfoo1j __attribute__((weak));
+
+
+extern int vfoo1k __attribute__((weak));
+int vfoo1k = 1;
+
+
+int vfoox1l = 1;
+extern int vfoo1l __attribute__((weak, alias ("vfoox1l")));