1 /* { dg-do compile } */
2 /* { dg-require-effective-target aarch64_variant_pcs } */
3 
4 /* Test that .variant_pcs is emitted for vector PCS symbol references.  */
5 
6 #define ATTR __attribute__ ((aarch64_vector_pcs))
7 
8 void f_undef_basepcs (void);
9 
f_def_basepcs(void)10 void f_def_basepcs (void)
11 {
12 }
13 
14 ATTR void f_undef_vpcs (void);
15 
f_def_vpcs(void)16 ATTR void f_def_vpcs (void)
17 {
18 }
19 
20 __attribute__ ((alias ("f_def_vpcs")))
21 ATTR void f_alias_vpcs (void);
22 
23 __attribute__ ((weak, alias ("f_def_vpcs")))
24 ATTR void f_weak_alias_vpcs (void);
25 
26 __attribute__ ((weak))
27 ATTR void f_weak_undef_vpcs (void);
28 
29 __attribute__ ((visibility ("protected")))
f_protected_vpcs(void)30 ATTR void f_protected_vpcs (void)
31 {
32 }
33 
34 __attribute__ ((visibility ("hidden")))
f_hidden_vpcs(void)35 ATTR void f_hidden_vpcs (void)
36 {
37 }
38 
f_local_vpcs(void)39 ATTR static void f_local_vpcs (void)
40 {
41 }
42 
43 __attribute__((weakref ("f_undef_vpcs")))
44 ATTR static void f_local_weakref_undef_vpcs (void);
45 
46 __attribute__((weakref ("f_hidden_vpcs")))
47 ATTR static void f_local_weakref_def_vpcs (void);
48 
49 ATTR void bar_undef_vpcs (void) __asm__ ("f_undef_renamed_vpcs");
50 
51 ATTR void bar_def_vpcs (void) __asm__ ("f_def_renamed_vpcs");
bar_def_vpcs(void)52 ATTR void bar_def_vpcs (void)
53 {
54 }
55 
56 void (*refs_basepcs[]) (void) = {
57 	f_undef_basepcs,
58 	f_def_basepcs,
59 };
60 
61 void (*ATTR refs_vpcs[]) (void) = {
62 	f_undef_vpcs,
63 	f_def_vpcs,
64 	f_alias_vpcs,
65 	f_weak_alias_vpcs,
66 	f_weak_undef_vpcs,
67 	f_protected_vpcs,
68 	f_hidden_vpcs,
69 	f_local_vpcs,
70 	f_local_weakref_undef_vpcs,
71 	f_local_weakref_def_vpcs,
72 	bar_undef_vpcs,
73 	bar_def_vpcs,
74 };
75 
76 /* Note: local symbols don't need .variant_pcs, but gcc generates it, so
77    we check them here.  An undefined weakref does not show up in the
78    symbol table, only the target symbol, so it does not need .variant_pcs.  */
79 
80 /* { dg-final { scan-assembler-not {\.variant_pcs\tf_undef_basepcs} } } */
81 /* { dg-final { scan-assembler-not {\.variant_pcs\tf_def_basepcs} } } */
82 /* { dg-final { scan-assembler-times {\.variant_pcs\tf_undef_vpcs} 1 } } */
83 /* { dg-final { scan-assembler-times {\.variant_pcs\tf_def_vpcs} 1 } } */
84 /* { dg-final { scan-assembler-times {\.variant_pcs\tf_alias_vpcs} 1 } } */
85 /* { dg-final { scan-assembler-times {\.variant_pcs\tf_weak_alias_vpcs} 1 } } */
86 /* { dg-final { scan-assembler-times {\.variant_pcs\tf_weak_undef_vpcs} 1 } } */
87 /* { dg-final { scan-assembler-times {\.variant_pcs\tf_protected_vpcs} 1 } } */
88 /* { dg-final { scan-assembler-times {\.variant_pcs\tf_hidden_vpcs} 1 } } */
89 /* { dg-final { scan-assembler-times {\.variant_pcs\tf_local_vpcs} 1 } } */
90 /* { dg-final { scan-assembler-not {\.variant_pcs\tf_local_weakref_undef_vpcs} } } */
91 /* { dg-final { scan-assembler-times {\.variant_pcs\tf_local_weakref_def_vpcs} 1 } } */
92 /* { dg-final { scan-assembler-times {\.variant_pcs\tf_undef_renamed_vpcs} 1 } } */
93 /* { dg-final { scan-assembler-times {\.variant_pcs\tf_def_renamed_vpcs} 1 } } */
94