1# RUN: llvm-mc -filetype=obj -triple=wasm32-unknown-unknown %p/Inputs/start.s -o %t.start.o 2# RUN: wasm-ld --export-memory=foo -o %t.wasm %t.start.o 3# RUN: obj2yaml %t.wasm | FileCheck %s 4 5# Verify that the --export-memory=<name> option changes the exported name of the module's memory 6 7# CHECK: - Type: EXPORT 8# CHECK-NEXT: Exports: 9# CHECK-NEXT: - Name: foo 10# CHECK-NEXT: Kind: MEMORY 11# CHECK-NEXT: Index: 0 12# CHECK-NEXT: - Name: _start 13# CHECK-NEXT: Kind: FUNCTION 14# CHECK-NEXT: Index: 0 15# CHECK-NEXT: - Type: 16 17# RUN:wasm-ld --export-memory --export-memory -o %t.unnamed.wasm %t.start.o 18# RUN: obj2yaml %t.unnamed.wasm | FileCheck -check-prefix=CHECK-UNNAMED %s 19 20# Verify that the --export-memory option without a parameter exports the memory 21# as "memory" 22 23# CHECK-UNNAMED: - Type: EXPORT 24# CHECK-UNNAMED-NEXT: Exports: 25# CHECK-UNNAMED-NEXT: - Name: memory 26# CHECK-UNNAMED-NEXT: Kind: MEMORY 27# CHECK-UNNAMED-NEXT: Index: 0 28# CHECK-UNNAMED-NEXT: - Name: _start 29# CHECK-UNNAMED-NEXT: Kind: FUNCTION 30# CHECK-UNNAMED-NEXT: Index: 0 31# CHECK-UNNAMED-NEXT: - Type: 32 33# RUN:wasm-ld --export-memory=foo --export-memory=foo -o %t.duplicate.wasm %t.start.o 34# RUN: obj2yaml %t.duplicate.wasm | FileCheck -check-prefix=CHECK-DUPLICATE %s 35 36# Verify that passing --export-memory with the same name twice works 37 38# CHECK-DUPLICATE: - Type: EXPORT 39# CHECK-DUPLICATE-NEXT: Exports: 40# CHECK-DUPLICATE-NEXT: - Name: foo 41# CHECK-DUPLICATE-NEXT: Kind: MEMORY 42# CHECK-DUPLICATE-NEXT: Index: 0 43# CHECK-DUPLICATE-NEXT: - Name: _start 44# CHECK-DUPLICATE-NEXT: Kind: FUNCTION 45# CHECK-DUPLICATE-NEXT: Index: 0 46# CHECK-DUPLICATE-NEXT: - Type: 47 48# RUN:wasm-ld --import-memory=foo,bar -o %t.import.wasm %t.start.o 49# RUN: obj2yaml %t.import.wasm | FileCheck -check-prefix=CHECK-IMPORT %s 50 51# Verify that memory imports can be renamed, and that no memory is exported by 52# default when memory is being imported 53 54# CHECK-IMPORT: - Type: IMPORT 55# CHECK-IMPORT-NEXT: Imports: 56# CHECK-IMPORT-NEXT: - Module: foo 57# CHECK-IMPORT-NEXT: Field: bar 58# CHECK-IMPORT-NEXT: Kind: MEMORY 59# CHECK-IMPORT-NEXT: Memory: 60# CHECK-IMPORT-NEXT: Minimum: 0x2 61# CHECK-IMPORT: - Type: EXPORT 62# CHECK-IMPORT-NEXT: Exports: 63# CHECK-IMPORT-NEXT: - Name: _start 64# CHECK-IMPORT-NEXT: Kind: FUNCTION 65# CHECK-IMPORT-NEXT: Index: 0 66# CHECK-IMPORT-NEXT: - Type: 67 68# RUN:wasm-ld --import-memory=foo,bar --export-memory=qux -o %t.both.wasm %t.start.o 69# RUN: obj2yaml %t.both.wasm | FileCheck -check-prefix=CHECK-BOTH %s 70 71# Verify that memory can be both imported and exported from a module 72 73# CHECK-BOTH: - Type: IMPORT 74# CHECK-BOTH-NEXT: Imports: 75# CHECK-BOTH-NEXT: - Module: foo 76# CHECK-BOTH-NEXT: Field: bar 77# CHECK-BOTH-NEXT: Kind: MEMORY 78# CHECK-BOTH-NEXT: Memory: 79# CHECK-BOTH-NEXT: Minimum: 0x2 80# CHECK-BOTH: - Type: EXPORT 81# CHECK-BOTH-NEXT: Exports: 82# CHECK-BOTH-NEXT: - Name: qux 83# CHECK-BOTH-NEXT: Kind: MEMORY 84# CHECK-BOTH-NEXT: Index: 0 85# CHECK-BOTH-NEXT: - Name: _start 86# CHECK-BOTH-NEXT: Kind: FUNCTION 87# CHECK-BOTH-NEXT: Index: 0 88# CHECK-BOTH-NEXT: - Type: 89