xref: /llvm-project/lld/test/ELF/lto/wrap-1.ll (revision 4e9277eda1874ead60f2c9d7cdb558fd19b32076)
1; REQUIRES: x86
2; LTO
3; RUN: llvm-as %s -o %t.o
4; RUN: ld.lld %t.o -o %t.out -wrap=bar -save-temps
5; RUN: llvm-readobj --symbols %t.out | FileCheck %s
6; RUN: cat %t.out.resolution.txt | FileCheck -check-prefix=RESOLS %s
7
8; ThinLTO
9; RUN: opt -module-summary %s -o %t.o
10; RUN: ld.lld %t.o -o %t.out -wrap=bar -save-temps
11; RUN: llvm-readobj --symbols %t.out | FileCheck %s
12; RUN: cat %t.out.resolution.txt | FileCheck -check-prefix=RESOLS %s
13
14; CHECK:      Name: __wrap_bar
15; CHECK-NEXT: Value:
16; CHECK-NEXT: Size:
17; CHECK-NEXT: Binding: Global
18; CHECK-NEXT: Type: Function
19
20; Make sure that the 'r' (linker redefined) bit is set for bar and __real_bar
21; in the resolutions file. The calls to bar and __real_bar will be routed to
22; __wrap_bar and bar, respectively. So they cannot be inlined.
23; RESOLS: ,bar,xr{{$}}
24; RESOLS: ,__wrap_bar,plx{{$}}
25; RESOLS: ,__real_bar,plr{{$}}
26
27target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
28target triple = "x86_64-unknown-linux-gnu"
29
30declare void @bar()
31
32define void @_start() {
33  call void @bar()
34  ret void
35}
36
37define void @__wrap_bar() {
38  ret void
39}
40
41define void @__real_bar() {
42  ret void
43}
44