1 ; RUN: llc -filetype=obj %s -o - | obj2yaml | FileCheck %s
3 target triple = "wasm32-unknown-unknown"
5 ; Verify that addresses of external functions generate correctly typed
6 ; imports and relocations of type R_TABLE_INDEX_I32.
8 declare void @f0(i32) #0
9 @ptr_to_f0 = hidden global void (i32)* @f0, align 4
11 attributes #0 = { "wasm-import-module"="somewhere" "wasm-import-name"="something" }
13 declare void @f1(i32) #1
14 @ptr_to_f1 = hidden global void (i32)* @f1, align 4
16 ; Check that varargs functions have correctly typed imports
17 declare i32 @varargs(i32, i32, ...)
18 define void @call(i32) {
19 %a = call i32 (i32, i32, ...) @varargs(i32 0, i32 0)
24 ; CHECK-NEXT: FileHeader:
25 ; CHECK-NEXT: Version: 0x00000001
26 ; CHECK-NEXT: Sections:
27 ; CHECK-NEXT: - Type: TYPE
28 ; CHECK-NEXT: Signatures:
29 ; CHECK-NEXT: - Index: 0
30 ; CHECK-NEXT: ReturnType: NORESULT
31 ; CHECK-NEXT: ParamTypes:
33 ; CHECK-NEXT: - Index: 1
34 ; CHECK-NEXT: ReturnType: I32
35 ; CHECK-NEXT: ParamTypes:
39 ; CHECK: - Type: IMPORT
40 ; CHECK-NEXT: Imports:
41 ; CHECK: - Module: env
42 ; CHECK-NEXT: Field: __linear_memory
43 ; CHECK: - Module: env
44 ; CHECK-NEXT: Field: __indirect_function_table
45 ; CHECK: - Module: env
46 ; CHECK-NEXT: Field: varargs
47 ; CHECK-NEXT: Kind: FUNCTION
48 ; CHECK-NEXT: SigIndex: 1
49 ; CHECK: - Module: somewhere
50 ; CHECK-NEXT: Field: something
51 ; CHECK: - Module: env
52 ; CHECK-NEXT: Field: f1
53 ; CHECK-NEXT: Kind: FUNCTION
54 ; CHECK-NEXT: SigIndex: 0
56 ; CHECK-NEXT: Segments:
57 ; CHECK-NEXT: - Offset:
58 ; CHECK-NEXT: Opcode: I32_CONST
59 ; CHECK-NEXT: Value: 1
60 ; CHECK-NEXT: Functions: [ 1, 2 ]
61 ; CHECK: - Type: DATA{{$}}
62 ; CHECK-NEXT: Relocations:
63 ; CHECK-NEXT: - Type: R_WASM_TABLE_INDEX_I32
64 ; CHECK-NEXT: Index: 3
65 ; CHECK-NEXT: Offset: 0x00000006