1 /* { dg-do compile } */
2 /* { dg-require-weak "" } */
3 /* { dg-options "-fno-common" } */
4 /* { dg-skip-if "" { x86_64-*-mingw* } { "*" } { "" } } */
5 /* NVPTX's definition of weak looks different to normal.  */
6 /* { dg-skip-if "" { nvptx-*-* } { "*" } { "" } } */
7 
8 /* { dg-final { scan-assembler "weak\[^ \t\]*\[ \t\]_?ffoo1a" } } */
9 /* { dg-final { scan-assembler "weak\[^ \t\]*\[ \t\]_?ffoo1b" } } */
10 /* { dg-final { scan-assembler "weak\[^ \t\]*\[ \t\]_?ffoo1c" } } */
11 /* { dg-final { scan-assembler-not "weak\[^ \t\]*\[ \t\]_?ffoo1d" } } */
12 /* { dg-final { scan-assembler "weak\[^ \t\]*\[ \t\]_?ffoo1e" } } */
13 
14 /* test function addresses with #pragma weak */
15 
16 #pragma weak ffoo1a
17 extern void * ffoo1a (void);
foo1a(void)18 void * foo1a (void)
19 {
20   return (void *)ffoo1a;
21 }
22 
23 extern void * ffoo1b (void);
24 #pragma weak ffoo1b
foo1b(void)25 void * foo1b (void)
26 {
27   return (void *)ffoo1b;
28 }
29 
30 extern void * ffoo1c (void);
foo1c(void)31 void * foo1c (void)
32 {
33   return (void *)ffoo1c;
34 }
35 #pragma weak ffoo1c
36 
37 
38 int ffoo1d (void);
39 #pragma weak ffoo1d
40 
41 
42 extern void * ffoo1e (void);
43 #pragma weak ffoo1e
foo1e(void)44 void * foo1e (void)
45 {
46   if (ffoo1e)
47     ffoo1e ();
48   return 0;
49 }
50 
51