1 # RUN: llvm-mc -mattr=+reference-types -triple=wasm32-unknown-unknown -filetype=obj -o %t.o %s
2 # RUN: wasm-ld --allow-undefined -o %t1.wasm %t.o
3 # RUN: obj2yaml %t1.wasm | FileCheck %s
10 # Same import module/name/type as `t1`, should be de-duped.
11 .tabletype t2, funcref
12 .import_module t2, env
16 # Imported as an externref instead of funcref, so should not be de-duped.
17 .tabletype t3, externref
18 .import_module t3, env
24 .functype _start () -> ()
43 ## XXX: the second imported table has index 1, not 0. I've verified by hand
44 ## (with `wasm2wat`) that the resulting Wasm file is correct: `t3` does end up
45 ## at index 1 and our `table.get` instructions are using the proper table index
46 ## immediates. This is also asserted (less legibly) in the hexdump of the code
47 ## body below. It looks like there's a bug in how `obj2yaml` disassembles
48 ## multiple table imports.
50 # CHECK: - Type: IMPORT
51 # CHECK-NEXT: Imports:
52 # CHECK-NEXT: - Module: env
53 # CHECK-NEXT: Field: t
54 # CHECK-NEXT: Kind: TABLE
56 # CHECK-NEXT: Index: 0
57 # CHECK-NEXT: ElemType: FUNCREF
59 # CHECK-NEXT: Minimum: 0x0
60 # CHECK-NEXT: - Module: env
61 # CHECK-NEXT: Field: t
62 # CHECK-NEXT: Kind: TABLE
64 # CHECK-NEXT: Index: 0
65 # CHECK-NEXT: ElemType: EXTERNREF
67 # CHECK-NEXT: Minimum: 0x0
71 # CHECK-NEXT: Functions:
72 # CHECK-NEXT: - Index: 0
73 # CHECK-NEXT: Locals: []
74 # CHECK-NEXT: Body: 41002580808080001A41002580808080001A41002581808080001A0B