2 // { dg-xfail-if "" { "powerpc-ibm-aix*" } { "*" } { "" } }
3 // { dg-require-alias "" }
4 // { dg-options "-O2 -fno-common" }
6 // Copyright 2005 Free Software Foundation, Inc.
7 // Contributed by Alexandre Oliva <aoliva@redhat.com>
11 // The unit-at-a-time call graph code used to fail to emit variables
12 // without external linkage that were only used indirectly, through
13 // aliases. Although the PR above is about #pragma weak-introduced
14 // aliases, the underlying machinery is the same.
16 #ifndef ATTRIBUTE_USED
17 # define ATTRIBUTE_USED __attribute__((used))
21 extern int Av1a __attribute__((alias ("lv1")));
25 extern int Av2a __attribute__((alias ("lv2")));
29 extern int Av3a __attribute__((alias ("lv3")));
30 static int *pv3a ATTRIBUTE_USED = &Av3a;
33 extern int Av4a __attribute__((alias ("lv4")));
34 static int *pv4a = &Av4a;
36 typedef void ftype(void);
38 static void lf1(void) {}
39 extern ftype Af1a __attribute__((alias ("lf1")));
42 static void lf2(void) {}
43 extern ftype Af2a __attribute__((alias ("lf2")));
46 static void lf3(void) {}
47 extern ftype Af3a __attribute__((alias ("lf3")));
48 static ftype *pf3a ATTRIBUTE_USED = &Af3a;
50 static void lf4(void) {}
51 extern ftype Af4a __attribute__((alias ("lf4")));
52 static ftype *pf4a = &Af4a;
55 asm volatile ("" : : "m" (pv4a), "m" (pf4a));