1 # RUN: llvm-mc -filetype=obj -triple=wasm32-unknown-unknown -o %t.o %s
9 # TLS data section of size 16 with as relocations at offset 8 and 12
10 .section tls_sec,"T",@
20 .section .custom_section.target_features,"",@
29 # RUN: wasm-ld --experimental-pic -pie -no-gc-sections --shared-memory --no-entry -o %t.wasm %t.o
30 # RUN: obj2yaml %t.wasm | FileCheck %s
31 # RUN: llvm-objdump -d --no-show-raw-insn --no-leading-addr %t.wasm | FileCheck --check-prefix=ASM %s --
33 # CHECK: - Type: GLOBAL
36 # CHECK-NEXT: Globals:
37 # CHECK-NEXT: - Index: 3
38 # CHECK-NEXT: Type: I32
39 # CHECK-NEXT: Mutable: true
40 # CHECK-NEXT: InitExpr:
41 # CHECK-NEXT: Opcode: I32_CONST
42 # CHECK-NEXT: Value: 0
45 # CHECK-NEXT: - Index: 4
46 # CHECK-NEXT: Type: I32
47 # CHECK-NEXT: Mutable: false
48 # CHECK-NEXT: InitExpr:
49 # CHECK-NEXT: Opcode: I32_CONST
50 # CHECK-NEXT: Value: 16
53 # CHECK-NEXT: - Index: 5
54 # CHECK-NEXT: Type: I32
55 # CHECK-NEXT: Mutable: false
56 # CHECK-NEXT: InitExpr:
57 # CHECK-NEXT: Opcode: I32_CONST
58 # CHECK-NEXT: Value: 4
60 # ASM: <__wasm_init_tls>:
62 # ASM-NEXT: local.get 0
63 # ASM-NEXT: global.set 3
64 # ASM-NEXT: local.get 0
65 # ASM-NEXT: i32.const 0
66 # ASM-NEXT: i32.const 16
67 # ASM-NEXT: memory.init 0, 0
68 # call to __wasm_apply_tls_relocs
72 # ASM: <__wasm_apply_tls_relocs>:
74 # ASM-NEXT: i32.const 8
75 # ASM-NEXT: global.get 3
77 # ASM-NEXT: global.get 1
78 # ASM-NEXT: i32.const 20
80 # ASM-NEXT: i32.store 0
81 # ASM-NEXT: i32.const 12
82 # ASM-NEXT: global.get 3
84 # ASM-NEXT: global.get 3
85 # ASM-NEXT: i32.const 4
87 # ASM-NEXT: i32.store 0