xref: /llvm-project/lld/test/COFF/wrap-lto-1.ll (revision 3785a413feef896e8a022731cc6ed405d5ebe81b)
1; REQUIRES: x86
2; LTO
3; RUN: llvm-as %s -o %t.obj
4; RUN: lld-link -out:%t.exe %t.obj -entry:entry -subsystem:console -wrap:bar -debug:symtab -lldsavetemps
5; RUN: cat %t.exe.resolution.txt | FileCheck -check-prefix=RESOLS %s
6
7; ThinLTO
8; RUN: opt -module-summary %s -o %t.obj
9; RUN: lld-link -out:%t.exe %t.obj -entry:entry -subsystem:console -wrap:bar -debug:symtab -lldsavetemps
10; RUN: cat %t.exe.resolution.txt | FileCheck -check-prefix=RESOLS %s
11
12; Make sure that the 'r' (linker redefined) bit is set for bar and __real_bar
13; in the resolutions file. The calls to bar and __real_bar will be routed to
14; __wrap_bar and bar, respectively. So they cannot be inlined.
15; RESOLS: ,bar,pxr{{$}}
16; RESOLS: ,__real_bar,xr{{$}}
17; RESOLS: ,__wrap_bar,px{{$}}
18
19target datalayout = "e-m:w-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
20target triple = "x86_64-w64-windows-gnu"
21
22define void @bar() {
23  ret void
24}
25
26define void @entry() {
27  call void @bar()
28  ret void
29}
30
31declare void @__real_bar()
32
33define void @__wrap_bar() {
34  call void @__real_bar()
35  ret void
36}
37