45 lines · plain
1# RUN: llvm-mc -triple=wasm32-unknown-unknown -filetype=obj -o %t.o %s2# RUN: wasm-ld %t.o -o %t.wasm3# RUN: obj2yaml %t.wasm | FileCheck %s4 5# Tests use of externref type, including storing it in a global6 7.globaltype my_global, externref8 9.globl read_externref10read_externref:11 .functype read_externref () -> (externref)12 global.get my_global13 end_function14 15.globl write_externref16write_externref:17 .functype write_externref (externref) -> ()18 local.get 019 global.set my_global20 end_function21 22my_global:23 24.globl _start25_start:26 .functype _start () -> ()27 call read_externref28 call write_externref29 end_function30 31# CHECK: - Type: GLOBAL32# CHECK-NEXT: Globals:33# CHECK-NEXT: - Index: 034# CHECK-NEXT: Type: I3235# CHECK-NEXT: Mutable: true36# CHECK-NEXT: InitExpr:37# CHECK-NEXT: Opcode: I32_CONST38# CHECK-NEXT: Value: 6553639# CHECK-NEXT: - Index: 140# CHECK-NEXT: Type: EXTERNREF41# CHECK-NEXT: Mutable: true42# CHECK-NEXT: InitExpr:43# CHECK-NEXT: Opcode: REF_NULL44# CHECK-NEXT: Type: EXTERNREF45