1 /* { dg-do compile } */
2 /* { dg-require-weak "" } */
3 /* { dg-require-alias "" } */
4 /* { dg-options "-fno-common" } */
5 /* { dg-skip-if "" { x86_64-*-mingw* } { "*" } { "" } } */
6 
7 /* { dg-final { scan-assembler "weak\[^ \t\]*\[ \t\]_?vfoo1a" } } */
8 /* { dg-final { scan-assembler "weak\[^ \t\]*\[ \t\]_?vfoo1b" } } */
9 /* { dg-final { scan-assembler "weak\[^ \t\]*\[ \t\]_?vfoo1c" } } */
10 /* { dg-final { scan-assembler "weak\[^ \t\]*\[ \t\]_?vfoo1d" } } */
11 /* { dg-final { scan-assembler "weak\[^ \t\]*\[ \t\]_?vfoo1e" } } */
12 /* { dg-final { scan-assembler "weak\[^ \t\]*\[ \t\]_?vfoo1f" } } */
13 /* { dg-final { scan-assembler "weak\[^ \t\]*\[ \t\]_?vfoo1g" } } */
14 /* { dg-final { scan-assembler "weak\[^ \t\]*\[ \t\]_?vfoo1h" } } */
15 /* { dg-final { scan-assembler "weak\[^ \t\]*\[ \t\]_?vfoo1i" } } */
16 /* { dg-final { scan-assembler "weak\[^ \t\]*\[ \t\]_?vfoo1j" } } */
17 /* { dg-final { scan-assembler "weak\[^ \t\]*\[ \t\]_?vfoo1k" } } */
18 /* { dg-final { scan-assembler "weak\[^ \t\]*\[ \t\]_?vfoo1l" } } */
19 
20 /* test variable addresses with __attribute__ ((weak)) */
21 
22 extern int vfoo1a __attribute__((weak));
23 extern int vfoo1a;
foo1a(void)24 void * foo1a (void)
25 {
26   return (void *)&vfoo1a;
27 }
28 
29 
30 extern int vfoo1b;
31 extern int vfoo1b __attribute__((weak));
foo1b(void)32 void * foo1b (void)
33 {
34   return (void *)&vfoo1b;
35 }
36 
37 
38 extern int vfoo1c;
foo1c(void)39 void * foo1c (void)
40 {
41   return (void *)&vfoo1c;
42 }
43 extern int vfoo1c __attribute__((weak));
44 
45 
46 extern int vfoo1d __attribute__((weak));
47 int vfoo1d;
foo1d(void)48 void * foo1d (void)
49 {
50   return (void *)&vfoo1d;
51 }
52 
53 
54 int vfoo1e;
55 extern int vfoo1e __attribute__((weak));
foo1e(void)56 void * foo1e (void)
57 {
58   return (void *)&vfoo1e;
59 }
60 
61 
62 int vfoo1f;
foo1f(void)63 void * foo1f (void)
64 {
65   return (void *)&vfoo1f;
66 }
67 extern int vfoo1f __attribute__((weak));
68 
69 
70 extern int vfoo1g;
foo1g(void)71 void * foo1g (void)
72 {
73   return (void *)&vfoo1g;
74 }
75 int vfoo1g __attribute__((weak));
76 
77 
78 extern int vfoo1h __attribute__((weak));
foo1h(void)79 void * foo1h (void)
80 {
81   return (void *)&vfoo1h;
82 }
83 extern int vfoo1h __attribute__((weak));
84 int vfoo1h;
85 
86 
87 extern int vfoo1i __attribute__((weak));
foo1i(void)88 void * foo1i (void)
89 {
90   return (void *)&vfoo1i;
91 }
92 extern int vfoo1i __attribute__((weak));
93 extern int vfoo1i;
94 
95 
96 extern int vfoo1j __attribute__((weak));
foo1j(void)97 void * foo1j (void)
98 {
99   return (void *)&vfoo1j;
100 }
101 extern int vfoo1j;
102 extern int vfoo1j __attribute__((weak));
103 
104 
105 extern int vfoo1k __attribute__((weak));
106 int vfoo1k = 1;
107 
108 
109 int vfoox1l = 1;
110 extern int vfoo1l __attribute__((weak, alias ("vfoox1l")));
111