llvm-project/lld/test/wasm/import-table.test

26 lines
918 B
Plaintext

# RUN: llvm-mc -filetype=obj -triple=wasm32-unknown-unknown %p/Inputs/start.s -o %t.start.o
# RUN: llvm-mc -filetype=obj -triple=wasm32-unknown-unknown %s -o %t.o
# RUN: wasm-ld --export-all --import-table -o %t.wasm %t.start.o %t.o
# RUN: obj2yaml %t.wasm | FileCheck %s
.globl require_function_table
require_function_table:
.functype require_function_table () -> ()
i32.const 1
call_indirect () -> ()
end_function
# Verify the --import-table flag creates a table import
# CHECK: - Type: IMPORT
# CHECK-NEXT: Imports:
# CHECK-NEXT: - Module: env
# CHECK-NEXT: Field: __indirect_function_table
# CHECK-NEXT: Kind: TABLE
# CHECK-NEXT: Table:
# CHECK-NEXT: Index: 0
# CHECK-NEXT: ElemType: FUNCREF
# CHECK-NEXT: Limits:
# CHECK-NEXT: Minimum: 0x1