1# RUN: llvm-mc -filetype=obj -triple=wasm32-unknown-unknown -o %t.o %s 2# RUN: wasm-ld %t.o -o %t.wasm 3# RUN: obj2yaml %t.wasm | FileCheck %s 4 5.globl _start 6.globl read_global 7.globl write_global 8 9.globaltype foo_global, i32 10.globaltype bar_global, f32 11.globaltype immutable_global, i32, immutable 12 13read_global: 14 .functype read_global () -> (i32) 15 global.get immutable_global 16 end_function 17 18write_global: 19 .functype write_global (i32) -> () 20 local.get 0 21 global.set foo_global 22 f32.const 1.0 23 global.set bar_global 24 end_function 25 26_start: 27 .functype _start () -> () 28 i32.const 1 29 call write_global 30 call read_global 31 drop 32 end_function 33 34foo_global: 35bar_global: 36immutable_global: 37 38# CHECK: - Type: GLOBAL 39# CHECK-NEXT: Globals: 40# CHECK-NEXT: - Index: 0 41# CHECK-NEXT: Type: I32 42# CHECK-NEXT: Mutable: true 43# CHECK-NEXT: InitExpr: 44# CHECK-NEXT: Opcode: I32_CONST 45# CHECK-NEXT: Value: 66560 46# CHECK-NEXT: - Index: 1 47# CHECK-NEXT: Type: I32 48# CHECK-NEXT: Mutable: false 49# CHECK-NEXT: InitExpr: 50# CHECK-NEXT: Opcode: I32_CONST 51# CHECK-NEXT: Value: 0 52# CHECK-NEXT: - Index: 2 53# CHECK-NEXT: Type: I32 54# CHECK-NEXT: Mutable: true 55# CHECK-NEXT: InitExpr: 56# CHECK-NEXT: Opcode: I32_CONST 57# CHECK-NEXT: Value: 0 58# CHECK-NEXT: - Index: 3 59# CHECK-NEXT: Type: F32 60# CHECK-NEXT: Mutable: true 61# CHECK-NEXT: InitExpr: 62# CHECK-NEXT: Opcode: F32_CONST 63# CHECK-NEXT: Value: 0 64