1# RUN: llvm-mc -filetype=obj -triple=wasm32-unknown-unknown %p/Inputs/start.s -o %t.start.o
2# RUN: wasm-ld --import-memory -o %t.wasm %t.start.o
3# RUN: obj2yaml %t.wasm | FileCheck %s
4
5# Verify the --import-memory flag creates a memory import
6
7# CHECK:       - Type:            IMPORT
8# CHECK-NEXT:    Imports:
9# CHECK-NEXT:      - Module:          env
10# CHECK-NEXT:        Field:           memory
11# CHECK-NEXT:        Kind:            MEMORY
12# CHECK-NEXT:        Memory:
13# CHECK-NEXT:          Initial:         0x2
14# CHECK-NEXT:  - Type:
15
16
17
18# RUN: wasm-ld --import-memory --initial-memory=262144 \
19# RUN:     --max-memory=327680 -o %t.max.wasm %t.start.o
20# RUN: obj2yaml %t.max.wasm | FileCheck -check-prefix=CHECK-MAX %s
21
22# Verify the --initial-memory and --max-memory arguments work with imports
23
24# CHECK-MAX:       - Type:            IMPORT
25# CHECK-MAX-NEXT:    Imports:
26# CHECK-MAX-NEXT:      - Module:          env
27# CHECK-MAX-NEXT:        Field:           memory
28# CHECK-MAX-NEXT:        Kind:            MEMORY
29# CHECK-MAX-NEXT:        Memory:
30# CHECK-MAX-NEXT:          Flags:           [ HAS_MAX ]
31# CHECK-MAX-NEXT:          Initial:         0x4
32# CHECK-MAX-NEXT:          Maximum:         0x5
33# CHECK-MAX-NEXT:  - Type:
34
35# RUN: wasm-ld --import-memory --shared-memory --features=atomics,bulk-memory \
36# RUN:     --initial-memory=262144 --max-memory=327680 -o %t.max.wasm %t.start.o
37# RUN: obj2yaml %t.max.wasm | FileCheck -check-prefix=CHECK-SHARED %s
38
39# Verify the --shared-memory flag works with imports
40
41# CHECK-SHARED:       - Type:            IMPORT
42# CHECK-SHARED-NEXT:    Imports:
43# CHECK-SHARED-NEXT:      - Module:          env
44# CHECK-SHARED-NEXT:        Field:           memory
45# CHECK-SHARED-NEXT:        Kind:            MEMORY
46# CHECK-SHARED-NEXT:        Memory:
47# CHECK-SHARED-NEXT:          Flags:           [ HAS_MAX, IS_SHARED ]
48# CHECK-SHARED-NEXT:          Initial:         0x4
49# CHECK-SHARED-NEXT:          Maximum:         0x5
50# CHECK-SHARED-NEXT:  - Type:
51