1; RUN: llc -filetype=obj %s -o - | llvm-readobj -r -expand-relocs | FileCheck %s 2 3target triple = "wasm32-unknown-unknown" 4 5; Pointers to functions of two different types 6@a = global i64 ()* inttoptr (i64 5 to i64 ()*), align 8 7@b = global i32 ()* inttoptr (i32 7 to i32 ()*), align 8 8 9; External functions 10declare i32 @c() 11declare i32 @d() 12 13define i32 @f1() { 14entry: 15 %aa = load i64 ()*, i64 ()** @a, align 8 16 %bb = load i32 ()*, i32 ()** @b, align 8 17 %tmp1 = call i64 %aa() 18 %tmp2 = call i32 %bb() 19 %tmp3 = call i32 @c() 20 %tmp4 = call i32 @d() 21 ret i32 %tmp2 22} 23 24 25; CHECK: Format: WASM 26; CHECK: Relocations [ 27; CHECK-NEXT: Section (4) CODE { 28; CHECK-NEXT: Relocation { 29; CHECK-NEXT: Type: R_WEBASSEMBLY_MEMORY_ADDR_LEB (3) 30; CHECK-NEXT: Offset: 0x9 31; CHECK-NEXT: Symbol: b 32; CHECK-NEXT: Addend: 0 33; CHECK-NEXT: } 34; CHECK-NEXT: Relocation { 35; CHECK-NEXT: Type: R_WEBASSEMBLY_MEMORY_ADDR_LEB (3) 36; CHECK-NEXT: Offset: 0x14 37; CHECK-NEXT: Symbol: a 38; CHECK-NEXT: Addend: 0 39; CHECK-NEXT: } 40; CHECK-NEXT: Relocation { 41; CHECK-NEXT: Type: R_WEBASSEMBLY_TYPE_INDEX_LEB (6) 42; CHECK-NEXT: Offset: 0x1A 43; CHECK-NEXT: Index: 0x1 44; CHECK-NEXT: } 45; CHECK-NEXT: Relocation { 46; CHECK-NEXT: Type: R_WEBASSEMBLY_TYPE_INDEX_LEB (6) 47; CHECK-NEXT: Offset: 0x24 48; CHECK-NEXT: Index: 0x0 49; CHECK-NEXT: } 50; CHECK-NEXT: Relocation { 51; CHECK-NEXT: Type: R_WEBASSEMBLY_FUNCTION_INDEX_LEB (0) 52; CHECK-NEXT: Offset: 0x2D 53; CHECK-NEXT: Symbol: c 54; CHECK-NEXT: } 55; CHECK-NEXT: Relocation { 56; CHECK-NEXT: Type: R_WEBASSEMBLY_FUNCTION_INDEX_LEB (0) 57; CHECK-NEXT: Offset: 0x34 58; CHECK-NEXT: Symbol: d 59; CHECK-NEXT: } 60; CHECK-NEXT: } 61; CHECK-NEXT: ] 62