2 // { dg-require-alias "" }
3 // { dg-options "-O2 -fno-common" }
5 // Copyright 2005 Free Software Foundation, Inc.
6 // Contributed by Alexandre Oliva <aoliva@redhat.com>
10 // The unit-at-a-time call graph code used to fail to emit variables
11 // without external linkage that were only used indirectly, through
12 // aliases. Although the PR above is about #pragma weak-introduced
13 // aliases, the underlying machinery is the same.
15 #ifndef ATTRIBUTE_USED
16 # define ATTRIBUTE_USED __attribute__((used))
20 extern int Av1a __attribute__((alias ("lv1")));
24 extern int Av2a __attribute__((alias ("lv2")));
28 extern int Av3a __attribute__((alias ("lv3")));
29 static int *pv3a ATTRIBUTE_USED = &Av3a;
32 extern int Av4a __attribute__((alias ("lv4")));
33 static int *pv4a = &Av4a;
35 typedef void ftype(void);
37 static void lf1(void) {}
38 extern ftype Af1a __attribute__((alias ("lf1")));
41 static void lf2(void) {}
42 extern ftype Af2a __attribute__((alias ("lf2")));
45 static void lf3(void) {}
46 extern ftype Af3a __attribute__((alias ("lf3")));
47 static ftype *pf3a ATTRIBUTE_USED = &Af3a;
49 static void lf4(void) {}
50 extern ftype Af4a __attribute__((alias ("lf4")));
51 static ftype *pf4a = &Af4a;
54 asm volatile ("" : : "m" (pv4a), "m" (pf4a));