61 lines · plain
1## Verifies runtime relocation code for addresses over 2gb works correctly.2## We have had issues with LEB encoding of address over 2gb in i32.const3## instruction leading to invalid binaries.4 5# RUN: llvm-mc -filetype=obj -triple=wasm32-unknown-unknown -o %t.o %s6# RUN: wasm-ld --global-base=2147483648 --experimental-pic --unresolved-symbols=import-dynamic -no-gc-sections --shared-memory --no-entry -o %t.wasm %t.o7# XUN: obj2yaml %t.wasm | FileCheck %s8# RUN: llvm-objdump -d --no-show-raw-insn --no-leading-addr %t.wasm | FileCheck %s --9 10.globl tls_sym11.globl data_sym12.globl _start13.globaltype __tls_base, i3214 15_start:16 .functype _start () -> ()17 global.get __tls_base18 i32.const tls_sym@TLSREL19 i32.add20 drop21 i32.const data_sym22 drop23 end_function24 25.section tls_sec,"T",@26.p2align 227tls_sym:28 .int32 029 .int32 extern_sym30 .size tls_sym, 831 32.section data_sec,"",@33.p2align 234data_sym:35 .int32 036 .int32 extern_sym37 .size data_sym, 838 39.section .custom_section.target_features,"",@40 .int8 241 .int8 4342 .int8 743 .ascii "atomics"44 .int8 4345 .int8 1146 .ascii "bulk-memory"47 48# CHECK: <__wasm_apply_data_relocs>:49# CHECK-EMPTY:50# CHECK-NEXT: i32.const -214748363651# CHECK-NEXT: global.get 052# CHECK-NEXT: i32.store 053# CHECK-NEXT: end54 55# CHECK: <__wasm_apply_tls_relocs>:56# CHECK-EMPTY:57# CHECK-NEXT: i32.const -214748364458# CHECK-NEXT: global.get 059# CHECK-NEXT: i32.store 060# CHECK-NEXT: end61