[DAGCombiner] Add target hook function to decide folding (mul (add x, c1), c2)
[llvm-project.git] / llvm / test / MC / ELF / type.s
blob972a881150f6b523682b38e9ad14a61dfad48e97
1 # RUN: llvm-mc -filetype=obj -triple=x86_64 %s | llvm-readelf -s - | FileCheck %s
3 # CHECK: Symbol table '.symtab' contains 34 entries:
4 # CHECK-NEXT: Num: Value Size Type Bind Vis Ndx Name
5 # CHECK-NEXT: 0: 0000000000000000 0 NOTYPE LOCAL DEFAULT UND
6 # CHECK-NEXT: 1: 0000000000000000 0 FUNC GLOBAL DEFAULT 2 foo
7 # CHECK-NEXT: 2: 0000000000000000 0 OBJECT GLOBAL DEFAULT 2 bar
8 # CHECK-NEXT: 3: 0000000000000000 0 OBJECT UNIQUE DEFAULT 2 zed
9 # CHECK-NEXT: 4: 0000000000000000 0 OBJECT GLOBAL DEFAULT 2 obj
10 # CHECK-NEXT: 5: 0000000000000000 0 FUNC GLOBAL DEFAULT 2 func
11 # CHECK-NEXT: 6: 0000000000000000 0 IFUNC GLOBAL DEFAULT 2 ifunc
12 # CHECK-NEXT: 7: 0000000000000000 0 TLS GLOBAL DEFAULT 2 tls
13 # CHECK-NEXT: 8: 0000000000000000 0 TLS GLOBAL DEFAULT 2 tls_quoted
14 # CHECK-NEXT: 9: 0000000000000000 0 TLS GLOBAL DEFAULT 2 tls_upper_case
15 # CHECK-NEXT: 10: 0000000000000000 0 IFUNC GLOBAL DEFAULT 2 sym1
16 # CHECK-NEXT: 11: 0000000000000000 0 FUNC GLOBAL DEFAULT 2 alias1
17 # CHECK-NEXT: 12: 0000000000000000 0 IFUNC GLOBAL DEFAULT 2 sym2
18 # CHECK-NEXT: 13: 0000000000000000 0 OBJECT GLOBAL DEFAULT 2 alias2
19 # CHECK-NEXT: 14: 0000000000000000 0 IFUNC GLOBAL DEFAULT 2 sym3
20 # CHECK-NEXT: 15: 0000000000000000 0 NOTYPE GLOBAL DEFAULT 2 alias3
21 # CHECK-NEXT: 16: 0000000000000000 0 FUNC GLOBAL DEFAULT 2 sym4
22 # CHECK-NEXT: 17: 0000000000000000 0 OBJECT GLOBAL DEFAULT 2 alias4
23 # CHECK-NEXT: 18: 0000000000000000 0 FUNC GLOBAL DEFAULT 2 sym5
24 # CHECK-NEXT: 19: 0000000000000000 0 NOTYPE GLOBAL DEFAULT 2 alias5
25 # CHECK-NEXT: 20: 0000000000000000 0 OBJECT GLOBAL DEFAULT 2 sym6
26 # CHECK-NEXT: 21: 0000000000000000 0 NOTYPE GLOBAL DEFAULT 2 alias6
27 # CHECK-NEXT: 22: 0000000000000000 0 IFUNC GLOBAL DEFAULT 2 sym7
28 # CHECK-NEXT: 23: 0000000000000000 0 TLS GLOBAL DEFAULT 2 alias7
29 # CHECK-NEXT: 24: 0000000000000000 0 FUNC GLOBAL DEFAULT 2 sym8
30 # CHECK-NEXT: 25: 0000000000000000 0 TLS GLOBAL DEFAULT 2 alias8
31 # CHECK-NEXT: 26: 0000000000000000 0 TLS GLOBAL DEFAULT 2 sym9
32 # CHECK-NEXT: 27: 0000000000000000 0 OBJECT GLOBAL DEFAULT 2 alias9
33 # CHECK-NEXT: 28: 0000000000000000 0 TLS GLOBAL DEFAULT 2 sym10
34 # CHECK-NEXT: 29: 0000000000000000 0 NOTYPE GLOBAL DEFAULT 2 alias10
35 # CHECK-NEXT: 30: 0000000000000000 0 TLS GLOBAL DEFAULT 2 sym11
36 # CHECK-NEXT: 31: 0000000000000000 0 IFUNC GLOBAL DEFAULT 2 alias11
37 # CHECK-NEXT: 32: 0000000000000000 0 TLS GLOBAL DEFAULT 2 sym12
38 # CHECK-NEXT: 33: 0000000000000000 0 FUNC GLOBAL DEFAULT 2 alias12
40 // Test that both % and @ are accepted.
41 .global foo
42 .type foo,%function
43 foo:
45 .global bar
46 .type bar,@object
47 bar:
49 .type zed,@gnu_unique_object
50 zed:
52 obj:
53 .global obj
54 .type obj,@object
55 .type obj,@notype
57 func:
58 .global func
59 .type func,@function
60 .type func,@object
62 ifunc:
63 .global ifunc
64 .type ifunc,@gnu_indirect_function
66 tls:
67 .global tls
68 .type tls,@tls_object
69 .type tls,@gnu_indirect_function
71 // Test that "<type>" is accepted.
72 tls_quoted:
73 .global tls_quoted
74 .type tls_quoted,"tls_object"
76 // Test that "<type>" is accepted.
77 tls_upper_case:
78 .global tls_upper_case
79 .type tls_upper_case,STT_TLS
81 // Test that .set doesnt downgrade the type:
82 // IFUNC > FUNC > OBJECT > NOTYPE
83 // TLS_OBJECT > OBJECT > NOTYPE
84 // also TLS_OBJECT is incompatible with IFUNC and FUNC
86 .global sym1
87 .type sym1, @gnu_indirect_function
88 alias1:
89 .global alias1
90 .type alias1, @function
91 .set sym1, alias1
93 .global sym2
94 .type sym2, @gnu_indirect_function
95 alias2:
96 .global alias2
97 .type alias2, @object
98 .set sym2, alias2
100 .global sym3
101 .type sym3, @gnu_indirect_function
102 alias3:
103 .global alias3
104 .type alias3, @notype
105 .set sym3, alias3
107 .global sym4
108 .type sym4, @function
109 alias4:
110 .global alias4
111 .type alias4, @object
112 .set sym4, alias4
114 .global sym5
115 .type sym5, @function
116 alias5:
117 .global alias5
118 .type alias5, @notype
119 .set sym5, alias5
121 .global sym6
122 .type sym6, @object
123 alias6:
124 .global alias6
125 .type alias6, @notype
126 .set sym6, alias6
128 .global sym7
129 .type sym7, @gnu_indirect_function
130 alias7:
131 .global alias7
132 .type alias7, @tls_object
133 .set sym7, alias7
135 .global sym8
136 .type sym8, @function
137 .global alias8
138 alias8:
139 .type alias8, @tls_object
140 .set sym8, alias8
142 .global sym9
143 .type sym9, @tls_object
144 alias9:
145 .global alias9
146 .type alias9, @object
147 .set sym9, alias9
149 .global sym10
150 .type sym10, @tls_object
151 alias10:
152 .global alias10
153 .type alias10, @notype
154 .set sym10, alias10
156 .global sym11
157 .type sym11, @tls_object
158 alias11:
159 .global alias11
160 .type alias11, @gnu_indirect_function
161 .set sym11, alias11
163 .global sym12
164 .type sym12, @tls_object
165 alias12:
166 .global alias12
167 .type alias12, @function
168 .set sym12, alias12