1; RUN: llc -filetype=obj %s -o %t.o
2; RUN: wasm-ld -wrap nosuchsym -wrap foo -o %t.wasm %t.o
3; RUN: wasm-ld -emit-relocs -wrap foo -o %t.wasm %t.o
4; RUN: obj2yaml %t.wasm | FileCheck %s
5
6target triple = "wasm32-unknown-unknown"
7
8define i32 @foo() {
9  ret i32 1
10}
11
12define void @_start() {
13entry:
14  call i32 @foo()
15  ret void
16}
17
18declare i32 @__real_foo()
19
20define i32 @__wrap_foo() {
21  %rtn = call i32 @__real_foo()
22  ret i32 %rtn
23}
24
25; CHECK:      - Type:            CODE
26; CHECK-NEXT:   Relocations:
27; CHECK-NEXT:     - Type:            R_WASM_FUNCTION_INDEX_LEB
28; CHECK-NEXT:       Index:           2
29; CHECK-NEXT:       Offset:          0x9
30; CHECK-NEXT:     - Type:            R_WASM_FUNCTION_INDEX_LEB
31; CHECK-NEXT:       Index:           0
32; CHECK-NEXT:       Offset:          0x13
33
34; CHECK:        FunctionNames:
35; CHECK-NEXT:      - Index:           0
36; CHECK-NEXT:        Name:            foo
37; CHECK-NEXT:      - Index:           1
38; CHECK-NEXT:        Name:            _start
39; CHECK-NEXT:      - Index:           2
40; CHECK-NEXT:        Name:            __wrap_foo
41