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