1# RUN: yaml2obj %s -o %t1.o
2
3# RUN: wasm-ld --no-entry --shared-memory --features=atomics,bulk-memory %t1.o -o - | obj2yaml | FileCheck %s --check-prefix SHARED
4
5# RUN: not wasm-ld --no-entry --shared-memory --max-memory=100000 %t1.o -o - 2>&1 | FileCheck %s --check-prefix SHARED-UNALIGNED
6
7# RUN: not wasm-ld --no-entry --shared-memory --max-memory=131072 --features=bulk-memory %t1.o -o - 2>&1 | FileCheck %s --check-prefix SHARED-NO-ATOMICS
8
9# RUN: not wasm-ld --no-entry --shared-memory --max-memory=131072 --features=atomics %t1.o -o - 2>&1 | FileCheck %s --check-prefix SHARED-NO-BULK-MEM
10
11# RUN: wasm-ld --relocatable --features=atomics %t1.o -o - | obj2yaml | FileCheck %s --check-prefix ATOMICS-RELOCATABLE
12
13# RUN: wasm-ld --no-entry --shared-memory --max-memory=131072 --features=atomics,bulk-memory %t1.o -o - | obj2yaml | FileCheck %s --check-prefix SHARED
14
15--- !WASM
16FileHeader:
17  Version:         0x00000001
18Sections:
19  - Type:            IMPORT
20    Imports:
21      - Module:          env
22        Field:           __linear_memory
23        Kind:            MEMORY
24        Memory:
25          Initial:         0x00000001
26      - Module:          env
27        Field:           __indirect_function_table
28        Kind:            TABLE
29        Table:
30          Index:           0
31          ElemType:        FUNCREF
32          Limits:
33            Initial:         0x00000000
34  - Type:            DATA
35    Segments:
36      - SectionOffset:   6
37        InitFlags:       0
38        Offset:
39          Opcode:          I32_CONST
40          Value:           0
41        Content:         68656C6C6F0A00
42  - Type:            CUSTOM
43    Name:            linking
44    Version:         2
45    SymbolTable:
46      - Index:           0
47        Kind:            DATA
48        Name:            hello_str
49        Flags:           [  ]
50        Segment:         0
51        Size:            7
52    SegmentInfo:
53      - Index:           0
54        Name:            .rodata.hello_str
55        Alignment:       0
56        Flags:           [  ]
57...
58
59# SHARED-UNALIGNED: maximum memory must be 65536-byte aligned{{$}}
60
61# SHARED-NO-ATOMICS: 'atomics' feature must be used in order to use shared memory
62
63# SHARED-NO-BULK-MEM: 'bulk-memory' feature must be used in order to use shared memory
64
65# ATOMICS-RELOCATABLE:        - Type:            MEMORY
66# ATOMICS-RELOCATABLE-NEXT:     Memories:
67# ATOMICS-RELOCATABLE-NEXT:         Initial:         0x1
68# ATOMICS-RELOCATABLE-NEXT:   - Type:
69
70# SHARED:        - Type:            MEMORY
71# SHARED-NEXT:     Memories:
72# SHARED-NEXT:       - Flags:           [ HAS_MAX, IS_SHARED ]
73# SHARED-NEXT:         Initial:         0x2
74# SHARED-NEXT:         Maximum:         0x2
75