1; RUN: llc -filetype=obj %s -o %t.o
2; RUN: wasm-ld -no-gc-sections --no-entry -o %t.wasm %t.o
3; RUN: obj2yaml %t.wasm | FileCheck %s --check-prefixes=CHECK,NO-BSS
4; RUN: wasm-ld -no-gc-sections --no-entry --import-memory -o %t.bss.wasm %t.o
5; RUN: obj2yaml %t.bss.wasm | FileCheck %s --check-prefixes=CHECK,BSS
6; RUN: wasm-ld -no-gc-sections --no-entry -o %t_reloc.o %t.o --relocatable
7; RUN: obj2yaml %t_reloc.o | FileCheck -check-prefix RELOC %s
8
9target datalayout = "e-m:e-p:32:32-i64:64-n32:64-S128"
10target triple = "wasm32-unknown-unknown"
11
12@bss = hidden global i32 zeroinitializer, align 4
13@foo = hidden global i32 zeroinitializer, section "WowZero!", align 4
14@bar = hidden constant i32 42, section "MyAwesomeSection", align 4
15@baz = hidden global i32 7, section "AnotherGreatSection", align 4
16
17; CHECK-LABEL: - Type:            DATA
18; CHECK-NEXT:    Segments:
19; CHECK-NEXT:      - SectionOffset:   7
20; CHECK-NEXT:        InitFlags:       0
21; CHECK-NEXT:        Offset:
22; CHECK-NEXT:          Opcode:          I32_CONST
23; CHECK-NEXT:          Value:           1024
24; CHECK-NEXT:        Content:         '00000000'
25; CHECK-NEXT:      - SectionOffset:   17
26; CHECK-NEXT:        InitFlags:       0
27; CHECK-NEXT:        Offset:
28; CHECK-NEXT:          Opcode:          I32_CONST
29; CHECK-NEXT:          Value:           1028
30; CHECK-NEXT:        Content:         2A000000
31; CHECK-NEXT:      - SectionOffset:   27
32; CHECK-NEXT:        InitFlags:       0
33; CHECK-NEXT:        Offset:
34; CHECK-NEXT:          Opcode:          I32_CONST
35; CHECK-NEXT:          Value:           1032
36; CHECK-NEXT:        Content:         '07000000'
37; BSS-NEXT:        - SectionOffset:   37
38; BSS-NEXT:          InitFlags:       0
39; BSS-NEXT:          Offset:
40; BSS-NEXT:            Opcode:          I32_CONST
41; BSS-NEXT:            Value:           1036
42; BSS-NEXT:          Content:         '00000000'
43; NO-BSS-NOT:      - SectionOffset:
44
45; RELOC-LABEL: SegmentInfo:
46; RELOC-NEXT:    - Index:           0
47; RELOC-NEXT:      Name:            'WowZero!'
48; RELOC-NEXT:      Alignment:       2
49; RELOC-NEXT:      Flags:           [  ]
50; RELOC-NEXT:    - Index:           1
51; RELOC-NEXT:      Name:            MyAwesomeSection
52; RELOC-NEXT:      Alignment:       2
53; RELOC-NEXT:      Flags:           [  ]
54; RELOC-NEXT:    - Index:           2
55; RELOC-NEXT:      Name:            AnotherGreatSection
56; RELOC-NEXT:      Alignment:       2
57; RELOC-NEXT:      Flags:           [  ]
58; RELOC-NEXT:    - Index:           3
59; RELOC-NEXT:      Name:            .bss.bss
60; RELOC-NEXT:      Alignment:       2
61; RELOC-NEXT:      Flags:           [  ]
62