1 ; RUN: llc -O2 -filetype=obj %s -o - | llvm-readobj -r -S --expand-relocs | FileCheck %s
3 target triple = "wasm32-unknown-unknown"
9 ; call the imports to make sure they are included in the imports section
10 define hidden void @call_imports() #0 {
12 %call = call i32 @import1()
13 %call1 = call i32 @import2()
17 ; take the address of the third import. This should generate a TABLE_INDEX
18 ; relocation with index of 0 since its the first and only address taken
20 define hidden void @call_indirect() #0 {
22 %adr = alloca i32 ()*, align 4
23 store i32 ()* @import3, i32 ()** %adr, align 4
27 ; CHECK: Type: ELEM (0x9)
30 ; CHECK: Relocations [
31 ; CHECK-NEXT: Section (5) CODE {
32 ; CHECK-NEXT: Relocation {
33 ; CHECK-NEXT: Type: R_WASM_FUNCTION_INDEX_LEB (0)
34 ; CHECK-NEXT: Offset: 0x4
35 ; CHECK-NEXT: Symbol: import1
37 ; CHECK-NEXT: Relocation {
38 ; CHECK-NEXT: Type: R_WASM_FUNCTION_INDEX_LEB (0)
39 ; CHECK-NEXT: Offset: 0xB
40 ; CHECK-NEXT: Symbol: import2
42 ; CHECK-NEXT: Relocation {
43 ; CHECK-NEXT: Type: R_WASM_GLOBAL_INDEX_LEB (7)
44 ; CHECK-NEXT: Offset: 0x15
45 ; CHECK-NEXT: Symbol: __stack_pointer
47 ; CHECK-NEXT: Relocation {
48 ; CHECK-NEXT: Type: R_WASM_TABLE_INDEX_SLEB (1)
49 ; CHECK-NEXT: Offset: 0x1E
50 ; CHECK-NEXT: Symbol: import3