1 # RUN: llvm-mc -triple=wasm32-unknown-unknown -mattr=+reference-types,+simd128,+nontrapping-fptoint,+exception-handling < %s | FileCheck %s
2 # Check that it converts to .o without errors:
3 # RUN: llvm-mc -triple=wasm32-unknown-unknown -filetype=obj -mattr=+reference-types,+simd128,+nontrapping-fptoint,+exception-handling < %s | obj2yaml | FileCheck -check-prefix=BIN %s
5 # Minimal test for type indices and table references in call_indirect.
8 .functype test0 (i32) -> (i32)
11 call_indirect
(f64
) -> (i32
)
16 # CHECK-NEXT: .functype test0 (i32) -> (i32)
17 # CHECK: call_indirect __indirect_function_table, (f64) -> (i32)
18 # CHECK-NEXT: end_function
21 # BIN-NEXT: FileHeader:
22 # BIN-NEXT: Version: 0x1
24 # BIN-NEXT: - Type: TYPE
25 # BIN-NEXT: Signatures:
26 # BIN-NEXT: - Index: 0
27 # BIN-NEXT: ParamTypes:
29 # BIN-NEXT: ReturnTypes:
31 # BIN-NEXT: - Index: 1
32 # BIN-NEXT: ParamTypes:
34 # BIN-NEXT: ReturnTypes:
36 # BIN-NEXT: - Type: IMPORT
38 # BIN-NEXT: - Module: env
39 # BIN-NEXT: Field: __linear_memory
40 # BIN-NEXT: Kind: MEMORY
42 # BIN-NEXT: Minimum: 0x0
43 # BIN-NEXT: - Module: env
44 # BIN-NEXT: Field: __indirect_function_table
45 # BIN-NEXT: Kind: TABLE
48 # BIN-NEXT: ElemType: FUNCREF
50 # BIN-NEXT: Minimum: 0x0
51 # BIN-NEXT: - Type: FUNCTION
52 # BIN-NEXT: FunctionTypes: [ 0 ]
53 # BIN-NEXT: - Type: CODE
54 # BIN-NEXT: Relocations:
55 # BIN-NEXT: - Type: R_WASM_TYPE_INDEX_LEB
57 # BIN-NEXT: Offset: 0xF
58 # BIN-NEXT: - Type: R_WASM_TABLE_NUMBER_LEB
60 # BIN-NEXT: Offset: 0x14
61 # BIN-NEXT: Functions:
62 # BIN-NEXT: - Index: 0
63 # BIN-NEXT: Locals: []
64 # BIN-NEXT: Body: 44000000000000F03F200011818080800080808080000B
65 # BIN-NEXT: - Type: CUSTOM
66 # BIN-NEXT: Name: linking
67 # BIN-NEXT: Version: 2
68 # BIN-NEXT: SymbolTable:
69 # BIN-NEXT: - Index: 0
70 # BIN-NEXT: Kind: FUNCTION
71 # BIN-NEXT: Name: test0
72 # BIN-NEXT: Flags: [ BINDING_LOCAL ]
73 # BIN-NEXT: Function: 0
74 # BIN-NEXT: - Index: 1
75 # BIN-NEXT: Kind: TABLE
76 # BIN-NEXT: Name: __indirect_function_table
77 # BIN-NEXT: Flags: [ UNDEFINED ]