[InstCombine] Signed saturation patterns
[llvm-core.git] / test / MC / WebAssembly / reloc-pic.s
blob626f8d993e3c6543036372a02edadde8c4ca1a55
1 # RUN: llvm-mc -triple=wasm32-unknown-unknown -filetype=obj < %s | obj2yaml | FileCheck %s
3 # Verify that @GOT relocation entryes result in R_WASM_GLOBAL_INDEX_LEB against
4 # against the corrsponding function or data symbol and that the corresponding
5 # data symbols are imported as a wasm globals.
7 load_default_data:
8 .functype load_default_data () -> (i32)
9 global.get default_data@GOT
10 i32.load 0
11 end_function
13 load_default_func:
14 .functype load_default_func () -> (i32)
15 global.get default_func@GOT
16 i32.load 0
17 end_function
19 load_hidden_data:
20 .functype load_hidden_data () -> (i32)
21 global.get __memory_base
22 i32.const .L.hidden_data@MBREL
23 i32.add
24 end_function
26 load_hidden_func:
27 .functype load_hidden_func () -> (i32)
28 global.get __table_base
29 i32.const hidden_func@TBREL
30 i32.add
31 end_function
33 hidden_func:
34 .functype hidden_func () -> (i32)
35 i32.const 0
36 end_function
38 .section .rodata.hidden_data,"",@
39 .L.hidden_data:
40 .int8 100
41 .size .L.hidden_data, 1
43 #.hidden hidden_func
44 #.hidden hidden_data
45 .size default_data, 4
46 .functype default_func () -> (i32)
48 # CHECK: --- !WASM
49 # CHECK-NEXT: FileHeader:
50 # CHECK-NEXT: Version: 0x00000001
51 # CHECK-NEXT: Sections:
52 # CHECK-NEXT: - Type: TYPE
53 # CHECK-NEXT: Signatures:
54 # CHECK-NEXT: - Index: 0
55 # CHECK-NEXT: ParamTypes: []
56 # CHECK-NEXT: ReturnTypes:
57 # CHECK-NEXT: - I32
58 # CHECK-NEXT: - Type: IMPORT
59 # CHECK-NEXT: Imports:
60 # CHECK-NEXT: - Module: env
61 # CHECK-NEXT: Field: __linear_memory
62 # CHECK-NEXT: Kind: MEMORY
63 # CHECK-NEXT: Memory:
64 # CHECK-NEXT: Initial: 0x00000001
65 # CHECK-NEXT: - Module: env
66 # CHECK-NEXT: Field: __indirect_function_table
67 # CHECK-NEXT: Kind: TABLE
68 # CHECK-NEXT: Table:
69 # CHECK-NEXT: ElemType: FUNCREF
70 # CHECK-NEXT: Limits:
71 # CHECK-NEXT: Initial: 0x00000000
72 # CHECK-NEXT: - Module: env
73 # CHECK-NEXT: Field: default_func
74 # CHECK-NEXT: Kind: FUNCTION
75 # CHECK-NEXT: SigIndex: 0
76 # CHECK-NEXT: - Module: GOT.mem
77 # CHECK-NEXT: Field: default_data
78 # CHECK-NEXT: Kind: GLOBAL
79 # CHECK-NEXT: GlobalType: I32
80 # CHECK-NEXT: GlobalMutable: true
81 # CHECK-NEXT: - Module: GOT.func
82 # CHECK-NEXT: Field: default_func
83 # CHECK-NEXT: Kind: GLOBAL
84 # CHECK-NEXT: GlobalType: I32
85 # CHECK-NEXT: GlobalMutable: true
86 # CHECK-NEXT: - Type: FUNCTION
87 # CHECK-NEXT: FunctionTypes: [ 0, 0, 0, 0, 0 ]
88 # CHECK-NEXT: - Type: DATACOUNT
89 # CHECK-NEXT: Count: 1
90 # CHECK-NEXT: - Type: CODE
91 # CHECK-NEXT: Relocations:
92 # CHECK-NEXT: - Type: R_WASM_GLOBAL_INDEX_LEB
93 # CHECK-NEXT: Index: 1
94 # CHECK-NEXT: Offset: 0x00000004
95 # CHECK-NEXT: - Type: R_WASM_GLOBAL_INDEX_LEB
96 # CHECK-NEXT: Index: 3
97 # CHECK-NEXT: Offset: 0x00000010
98 # CHECK-NEXT: - Type: R_WASM_MEMORY_ADDR_LEB
99 # CHECK-NEXT: Index: 5
100 # CHECK-NEXT: Offset: 0x0000001C
101 # CHECK-NEXT: - Type: R_WASM_MEMORY_ADDR_REL_SLEB
102 # CHECK-NEXT: Index: 6
103 # CHECK-NEXT: Offset: 0x00000022
104 # CHECK-NEXT: - Type: R_WASM_MEMORY_ADDR_LEB
105 # CHECK-NEXT: Index: 8
106 # CHECK-NEXT: Offset: 0x0000002C
107 # CHECK-NEXT: - Type: R_WASM_TABLE_INDEX_REL_SLEB
108 # CHECK-NEXT: Index: 9
109 # CHECK-NEXT: Offset: 0x00000032
110 # CHECK-NEXT: Functions:
111 # CHECK-NEXT: - Index: 1
112 # CHECK-NEXT: Locals: []
113 # CHECK-NEXT: Body: 2380808080002802000B
114 # CHECK-NEXT: - Index: 2
115 # CHECK-NEXT: Locals: []
116 # CHECK-NEXT: Body: 2381808080002802000B
117 # CHECK-NEXT: - Index: 3
118 # CHECK-NEXT: Locals: []
119 # CHECK-NEXT: Body: 2380808080004180808080006A0B
120 # CHECK-NEXT: - Index: 4
121 # CHECK-NEXT: Locals: []
122 # CHECK-NEXT: Body: 2380808080004180808080006A0B
123 # CHECK-NEXT: - Index: 5
124 # CHECK-NEXT: Locals: []
125 # CHECK-NEXT: Body: 41000B
126 # CHECK-NEXT: - Type: DATA
127 # CHECK-NEXT: Segments:
128 # CHECK-NEXT: - SectionOffset: 6
129 # CHECK-NEXT: InitFlags: 0
130 # CHECK-NEXT: Offset:
131 # CHECK-NEXT: Opcode: I32_CONST
132 # CHECK-NEXT: Value: 0
133 # CHECK-NEXT: Content: '64'
134 # CHECK-NEXT: - Type: CUSTOM
135 # CHECK-NEXT: Name: linking
136 # CHECK-NEXT: Version: 2
137 # CHECK-NEXT: SymbolTable:
138 # CHECK-NEXT: - Index: 0
139 # CHECK-NEXT: Kind: FUNCTION
140 # CHECK-NEXT: Name: load_default_data
141 # CHECK-NEXT: Flags: [ BINDING_LOCAL ]
142 # CHECK-NEXT: Function: 1
143 # CHECK-NEXT: - Index: 1
144 # CHECK-NEXT: Kind: DATA
145 # CHECK-NEXT: Name: default_data
146 # CHECK-NEXT: Flags: [ UNDEFINED ]
147 # CHECK-NEXT: - Index: 2
148 # CHECK-NEXT: Kind: FUNCTION
149 # CHECK-NEXT: Name: load_default_func
150 # CHECK-NEXT: Flags: [ BINDING_LOCAL ]
151 # CHECK-NEXT: Function: 2
152 # CHECK-NEXT: - Index: 3
153 # CHECK-NEXT: Kind: FUNCTION
154 # CHECK-NEXT: Name: default_func
155 # CHECK-NEXT: Flags: [ UNDEFINED ]
156 # CHECK-NEXT: Function: 0
157 # CHECK-NEXT: - Index: 4
158 # CHECK-NEXT: Kind: FUNCTION
159 # CHECK-NEXT: Name: load_hidden_data
160 # CHECK-NEXT: Flags: [ BINDING_LOCAL ]
161 # CHECK-NEXT: Function: 3
162 # CHECK-NEXT: - Index: 5
163 # CHECK-NEXT: Kind: DATA
164 # CHECK-NEXT: Name: __memory_base
165 # CHECK-NEXT: Flags: [ UNDEFINED ]
166 # CHECK-NEXT: - Index: 6
167 # CHECK-NEXT: Kind: DATA
168 # CHECK-NEXT: Name: .L.hidden_data
169 # CHECK-NEXT: Flags: [ BINDING_LOCAL ]
170 # CHECK-NEXT: Segment: 0
171 # CHECK-NEXT: Size: 1
172 # CHECK-NEXT: - Index: 7
173 # CHECK-NEXT: Kind: FUNCTION
174 # CHECK-NEXT: Name: load_hidden_func
175 # CHECK-NEXT: Flags: [ BINDING_LOCAL ]
176 # CHECK-NEXT: Function: 4
177 # CHECK-NEXT: - Index: 8
178 # CHECK-NEXT: Kind: DATA
179 # CHECK-NEXT: Name: __table_base
180 # CHECK-NEXT: Flags: [ UNDEFINED ]
181 # CHECK-NEXT: - Index: 9
182 # CHECK-NEXT: Kind: FUNCTION
183 # CHECK-NEXT: Name: hidden_func
184 # CHECK-NEXT: Flags: [ BINDING_LOCAL ]
185 # CHECK-NEXT: Function: 5
186 # CHECK-NEXT: SegmentInfo:
187 # CHECK-NEXT: - Index: 0
188 # CHECK-NEXT: Name: .rodata.hidden_data
189 # CHECK-NEXT: Alignment: 0
190 # CHECK-NEXT: Flags: [ ]
191 # CHECK-NEXT: ...