1# Test that linking without shared memory causes __tls_base to be
2# interlized
3
4# RUN: llvm-mc -filetype=obj -triple=wasm32-unknown-unknown -o %t.o %s
5
6.globaltype __tls_base, i32
7
8.globl get_tls1
9get_tls1:
10  .functype get_tls1 () -> (i32)
11  global.get __tls_base
12  i32.const tls1
13  i32.add
14  end_function
15
16.section  .data.no_tls,"",@
17.globl  no_tls
18.p2align  2
19no_tls:
20  .int32  42
21  .size no_tls, 4
22
23.section  .tdata.tls1,"",@
24.globl  tls1
25.p2align  2
26tls1:
27  .int32  43
28  .size tls1, 2
29
30.section  .custom_section.target_features,"",@
31  .int8 2
32  .int8 43
33  .int8 7
34  .ascii  "atomics"
35  .int8 43
36  .int8 11
37  .ascii  "bulk-memory"
38
39# RUN: wasm-ld --no-gc-sections --no-entry -o %t.wasm %t.o
40# RUN: obj2yaml %t.wasm | FileCheck %s
41
42#      CHECK:   - Type:            GLOBAL
43# __stack_pointer
44# CHECK-NEXT:     Globals:
45# CHECK-NEXT:       - Index:           0
46# CHECK-NEXT:         Type:            I32
47# CHECK-NEXT:         Mutable:         true
48# CHECK-NEXT:         InitExpr:
49# CHECK-NEXT:           Opcode:          I32_CONST
50# CHECK-NEXT:           Value:           66576
51# __tls_base
52# CHECK-NEXT:       - Index:           1
53# CHECK-NEXT:         Type:            I32
54# CHECK-NEXT:         Mutable:         false
55# CHECK-NEXT:         InitExpr:
56# CHECK-NEXT:           Opcode:          I32_CONST
57# CHECK-NEXT:           Value:           1028
58# CHECK-NEXT:   - Type:            EXPORT
59
60#      CHECK:  - Type:            DATA
61# .data
62# CHECK-NEXT:    Segments:
63# CHECK-NEXT:      - SectionOffset:   7
64# CHECK-NEXT:        InitFlags:       0
65# CHECK-NEXT:        Offset:
66# CHECK-NEXT:          Opcode:          I32_CONST
67# CHECK-NEXT:          Value:           1024
68# CHECK-NEXT:        Content:         2A000000
69# .tdata
70# CHECK-NEXT:      - SectionOffset:   17
71# CHECK-NEXT:        InitFlags:       0
72# CHECK-NEXT:        Offset:
73# CHECK-NEXT:          Opcode:          I32_CONST
74# CHECK-NEXT:          Value:           1028
75# CHECK-NEXT:        Content:         2B000000
76