|
2 | 2 | # RUN: llvm-mc -filetype=obj -triple=wasm32-unknown-emscripten %S/Inputs/internal_func.s -o %t.internal_func.o |
3 | 3 | # RUN: wasm-ld --no-gc-sections --experimental-pic -pie --unresolved-symbols=import-dynamic -o %t.wasm %t.o %t.internal_func.o |
4 | 4 | # RUN: obj2yaml %t.wasm | FileCheck %s |
5 | | -# RUN: llvm-objdump --disassemble-symbols=__wasm_call_ctors,__wasm_apply_data_relocs --no-show-raw-insn --no-leading-addr %t.wasm | FileCheck %s --check-prefixes DISASSEM |
| 5 | +# RUN: llvm-objdump --disassemble-symbols=__wasm_call_ctors,__wasm_apply_data_relocs,__wasm_apply_global_relocs --no-show-raw-insn --no-leading-addr %t.wasm | FileCheck %s --check-prefixes DISASSEM |
6 | 6 |
|
7 | 7 | .functype external_func () -> () |
8 | 8 | .functype internal_func1 () -> (i32) |
|
41 | 41 | drop |
42 | 42 |
|
43 | 43 | global.get __stack_pointer |
| 44 | + drop |
| 45 | + |
| 46 | + global.get __wasm_first_page_end@GOT |
44 | 47 | end_function |
45 | 48 |
|
46 | 49 | get_data_address: |
@@ -145,6 +148,18 @@ _start: |
145 | 148 | # DISASSEM-LABEL: <__wasm_apply_data_relocs>: |
146 | 149 | # DISASSEM: end |
147 | 150 |
|
| 151 | +# global 6 is __wasm_first_page_end, which is ABSOLUTE and |
| 152 | +# thus should not be relocated. |
| 153 | +# |
| 154 | +# DISASSEM-LABEL: <__wasm_apply_global_relocs>: |
| 155 | +# DISASSEM: global.set 4 |
| 156 | +# DISASSEM: global.set 5 |
| 157 | +# DISASSEM-NOT: global.set 6 |
| 158 | +# DISASSEM: global.set 7 |
| 159 | +# DISASSEM: global.set 8 |
| 160 | +# DISASSEM: global.set 9 |
| 161 | +# DISASSEM: end |
| 162 | + |
148 | 163 | # Run the same test with extended-const support. When this is available |
149 | 164 | # we don't need __wasm_apply_global_relocs and instead rely on the add |
150 | 165 | # instruction in the InitExpr. We also, therefore, do not need these globals |
@@ -173,17 +188,23 @@ _start: |
173 | 188 | # EXTENDED-CONST-NEXT: Type: I32 |
174 | 189 | # EXTENDED-CONST-NEXT: Mutable: false |
175 | 190 | # EXTENDED-CONST-NEXT: InitExpr: |
| 191 | +# EXTENDED-CONST-NEXT: Opcode: I32_CONST |
| 192 | +# EXTENDED-CONST-NEXT: Value: 65536 |
| 193 | +# EXTENDED-CONST-NEXT: - Index: 7 |
| 194 | +# EXTENDED-CONST-NEXT: Type: I32 |
| 195 | +# EXTENDED-CONST-NEXT: Mutable: false |
| 196 | +# EXTENDED-CONST-NEXT: InitExpr: |
176 | 197 | # EXTENDED-CONST-NEXT: Extended: true |
177 | 198 | # This instruction sequence decodes to: |
178 | 199 | # (global.get[0x23] 0x1 i32.const[0x41] 0x0C i32.add[0x6A] end[0x0b]) |
179 | 200 | # EXTENDED-CONST-NEXT: Body: 2301410C6A0B |
180 | | -# EXTENDED-CONST-NEXT: - Index: 7 |
| 201 | +# EXTENDED-CONST-NEXT: - Index: 8 |
181 | 202 | # EXTENDED-CONST-NEXT: Type: I32 |
182 | 203 | # EXTENDED-CONST-NEXT: Mutable: false |
183 | 204 | # EXTENDED-CONST-NEXT: InitExpr: |
184 | 205 | # EXTENDED-CONST-NEXT: Opcode: GLOBAL_GET |
185 | 206 | # EXTENDED-CONST-NEXT: Index: 2 |
186 | | -# EXTENDED-CONST-NEXT: - Index: 8 |
| 207 | +# EXTENDED-CONST-NEXT: - Index: 9 |
187 | 208 | # EXTENDED-CONST-NEXT: Type: I32 |
188 | 209 | # EXTENDED-CONST-NEXT: Mutable: false |
189 | 210 | # EXTENDED-CONST-NEXT: InitExpr: |
|
0 commit comments