1 ; RUN: llc -mtriple=x86_64-linux-gnu -relocation-model=pic -data-sections -o - %s --asm-verbose=0 | FileCheck %s -check-prefixes=CHECK
3 ; Just ensure that we can write to an object file without error.
4 ; RUN: llc -filetype=obj -mtriple=x86_64-linux-gnu -relocation-model=pic -data-sections -o /dev/null %s
6 declare void @extern_func()
8 ; CHECK: call_extern_func:
9 ; CHECK: callq extern_func@PLT
10 define void @call_extern_func() {
11 call void dso_local_equivalent @extern_func()
15 declare hidden void @hidden_func()
16 declare protected void @protected_func()
17 declare dso_local void @dso_local_func()
18 define internal void @internal_func() {
22 define private void @private_func() {
27 ; CHECK: call_hidden_func:
28 ; CHECK: callq hidden_func{{$}}
29 define void @call_hidden_func() {
30 call void dso_local_equivalent @hidden_func()
34 ; CHECK: call_protected_func:
35 ; CHECK: callq protected_func{{$}}
36 define void @call_protected_func() {
37 call void dso_local_equivalent @protected_func()
41 ; CHECK: call_dso_local_func:
42 ; CHECK: callq dso_local_func{{$}}
43 define void @call_dso_local_func() {
44 call void dso_local_equivalent @dso_local_func()
48 ; CHECK: call_internal_func:
49 ; CHECK: callq internal_func{{$}}
50 define void @call_internal_func() {
51 call void dso_local_equivalent @internal_func()
55 define void @aliasee_func() {
60 @alias_func = alias void (), ptr @aliasee_func
61 @dso_local_alias_func = dso_local alias void (), ptr @aliasee_func
63 ; CHECK: call_alias_func:
64 ; CHECK: callq alias_func@PLT
65 define void @call_alias_func() {
66 call void dso_local_equivalent @alias_func()
70 ; CHECK: call_dso_local_alias_func:
71 ; CHECK: callq .Ldso_local_alias_func$local{{$}}
72 define void @call_dso_local_alias_func() {
73 call void dso_local_equivalent @dso_local_alias_func()
77 @ifunc_func = ifunc void (), ptr @resolver
78 @dso_local_ifunc_func = dso_local ifunc void (), ptr @resolver
80 define internal ptr @resolver() {
85 ; If an ifunc is not dso_local already, then we should still emit a stub for it
86 ; to ensure it will be dso_local.
87 ; CHECK: call_ifunc_func:
88 ; CHECK: callq ifunc_func@PLT
89 define void @call_ifunc_func() {
90 call void dso_local_equivalent @ifunc_func()
94 ; CHECK: call_dso_local_ifunc_func:
95 ; CHECK: callq dso_local_ifunc_func{{$}}
96 define void @call_dso_local_ifunc_func() {
97 call void dso_local_equivalent @dso_local_ifunc_func()
102 ;; Ensure dso_local_equivalent works the exact same way as the previous
103 ;; examples but with forward-referenced symbols.
105 ; CHECK: call_forward_func:
106 ; CHECK: callq forward_extern_func@PLT
107 define void @call_forward_func() {
108 call void dso_local_equivalent @forward_extern_func()
112 ; CHECK: call_forward_hidden_func:
113 ; CHECK: callq forward_hidden_func{{$}}
114 define void @call_forward_hidden_func() {
115 call void dso_local_equivalent @forward_hidden_func()
119 ; CHECK: call_forward_protected_func:
120 ; CHECK: callq forward_protected_func{{$}}
121 define void @call_forward_protected_func() {
122 call void dso_local_equivalent @forward_protected_func()
126 ; CHECK: call_forward_dso_local_func:
127 ; CHECK: callq forward_dso_local_func{{$}}
128 define void @call_forward_dso_local_func() {
129 call void dso_local_equivalent @forward_dso_local_func()
133 ; CHECK: call_forward_internal_func:
134 ; CHECK: callq forward_internal_func{{$}}
135 define void @call_forward_internal_func() {
136 call void dso_local_equivalent @forward_internal_func()
140 declare hidden void @forward_hidden_func()
141 declare protected void @forward_protected_func()
142 declare dso_local void @forward_dso_local_func()
143 define internal void @forward_internal_func() {
147 define private void @forward_private_func() {
152 ; CHECK: call_forward_alias_func:
153 ; CHECK: callq forward_alias_func@PLT
154 define void @call_forward_alias_func() {
155 call void dso_local_equivalent @forward_alias_func()
159 ; CHECK: call_forward_dso_local_alias_func:
160 ; CHECK: callq .Lforward_dso_local_alias_func$local{{$}}
161 define void @call_forward_dso_local_alias_func() {
162 call void dso_local_equivalent @forward_dso_local_alias_func()
166 define void @forward_aliasee_func() {
171 @forward_alias_func = alias void (), ptr @forward_aliasee_func
172 @forward_dso_local_alias_func = dso_local alias void (), ptr @forward_aliasee_func
174 ; If an ifunc is not dso_local already, then we should still emit a stub for it
175 ; to ensure it will be dso_local.
176 ; CHECK: call_forward_ifunc_func:
177 ; CHECK: callq forward_ifunc_func@PLT
178 define void @call_forward_ifunc_func() {
179 call void dso_local_equivalent @forward_ifunc_func()
183 ; CHECK: call_forward_dso_local_ifunc_func:
184 ; CHECK: callq forward_dso_local_ifunc_func{{$}}
185 define void @call_forward_dso_local_ifunc_func() {
186 call void dso_local_equivalent @forward_dso_local_ifunc_func()
190 @forward_ifunc_func = ifunc void (), ptr @resolver
191 @forward_dso_local_ifunc_func = dso_local ifunc void (), ptr @resolver
193 ;; Test "no-named" variables
194 ; CHECK: call_no_name_hidden:
195 ; CHECK: callq __unnamed_{{[0-9]+}}{{$}}
196 define void @call_no_name_hidden() {
197 call void dso_local_equivalent @0()
201 ; CHECK: call_no_name_extern:
202 ; CHECK: callq __unnamed_{{[0-9]+}}@PLT
203 define void @call_no_name_extern() {
204 call void dso_local_equivalent @1()
208 declare hidden void @0()
211 ;; Note that we keep this at the very end because llc emits this after all the
214 ; CHECK: .long forward_extern_func@PLT
215 @const = constant i32 trunc (i64 ptrtoint (ptr dso_local_equivalent @forward_extern_func to i64) to i32)
217 declare void @forward_extern_func()