Files
llvm/lld/test/wasm/import-memory.test
Thomas Lively 09768c5d7a [WebAssembly] Initialize memory in start function
Summary:
 - `__wasm_init_memory` is now the WebAssembly start function instead
   of being called from `__wasm_call_ctors` or called directly by the
   runtime.
 - Adds a new synthetic data symbol `__wasm_init_memory_flag` that is
   atomically incremented from zero to one by the thread responsible
   for initializing memory.
 - All threads now unconditionally perform data.drop on all passive
   segments.
 - Removes --passive-segments and --active-segments flags and controls
   segment type based on --shared-memory instead. The deleted flags
   were only present to ameliorate the upgrade path in Emscripten.

Reviewers: sbc100, aheejin

Subscribers: dschuff, jgravelle-google, sunfish, jfb, llvm-commits

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D65783

llvm-svn: 370965
2019-09-04 19:50:39 +00:00

51 lines
1.9 KiB
Plaintext

# RUN: llc -filetype=obj %p/Inputs/start.ll -o %t.start.o
# RUN: wasm-ld --import-memory -o %t.wasm %t.start.o
# RUN: obj2yaml %t.wasm | FileCheck %s
# Verify the --import-memory flag creates a memory import
# CHECK: - Type: IMPORT
# CHECK-NEXT: Imports:
# CHECK-NEXT: - Module: env
# CHECK-NEXT: Field: memory
# CHECK-NEXT: Kind: MEMORY
# CHECK-NEXT: Memory:
# CHECK-NEXT: Initial: 0x00000002
# CHECK-NEXT: - Type:
# RUN: wasm-ld --import-memory --initial-memory=262144 \
# RUN: --max-memory=327680 -o %t.max.wasm %t.start.o
# RUN: obj2yaml %t.max.wasm | FileCheck -check-prefix=CHECK-MAX %s
# Verify the --initial-memory and --max-memory arguments work with imports
# CHECK-MAX: - Type: IMPORT
# CHECK-MAX-NEXT: Imports:
# CHECK-MAX-NEXT: - Module: env
# CHECK-MAX-NEXT: Field: memory
# CHECK-MAX-NEXT: Kind: MEMORY
# CHECK-MAX-NEXT: Memory:
# CHECK-MAX-NEXT: Flags: [ HAS_MAX ]
# CHECK-MAX-NEXT: Initial: 0x00000004
# CHECK-MAX-NEXT: Maximum: 0x00000005
# CHECK-MAX-NEXT: - Type:
# RUN: wasm-ld --import-memory --shared-memory --features=atomics,bulk-memory \
# RUN: --initial-memory=262144 --max-memory=327680 -o %t.max.wasm %t.start.o
# RUN: obj2yaml %t.max.wasm | FileCheck -check-prefix=CHECK-SHARED %s
# Verify the --shared-memory flag works with imports
# CHECK-SHARED: - Type: IMPORT
# CHECK-SHARED-NEXT: Imports:
# CHECK-SHARED-NEXT: - Module: env
# CHECK-SHARED-NEXT: Field: memory
# CHECK-SHARED-NEXT: Kind: MEMORY
# CHECK-SHARED-NEXT: Memory:
# CHECK-SHARED-NEXT: Flags: [ HAS_MAX, IS_SHARED ]
# CHECK-SHARED-NEXT: Initial: 0x00000004
# CHECK-SHARED-NEXT: Maximum: 0x00000005
# CHECK-SHARED-NEXT: - Type: