2 ; RUN: split-file %s %t.dir
4 ; RUN: llvm-as %t.dir/main.ll -o %t.main.bc
5 ; RUN: llvm-as %t.dir/wrap.ll -o %t.wrap.bc
6 ; RUN: llvm-as %t.dir/other.ll -o %t.other.bc
8 ; RUN: llvm-ar rcs %t.bc.lib %t.wrap.bc %t.other.bc
10 ; RUN: opt -module-summary %t.dir/main.ll -o %t.main.thin
11 ; RUN: opt -module-summary %t.dir/wrap.ll -o %t.wrap.thin
12 ; RUN: opt -module-summary %t.dir/other.ll -o %t.other.thin
13 ; RUN: rm -f %t.thin.lib
14 ; RUN: llvm-ar rcs %t.thin.lib %t.wrap.thin %t.other.thin
16 ; RUN: llc %t.dir/main.ll -o %t.main.obj --filetype=obj
17 ; RUN: llc %t.dir/wrap.ll -o %t.wrap.obj --filetype=obj
18 ; RUN: llc %t.dir/other.ll -o %t.other.obj --filetype=obj
19 ; RUN: rm -f %t.obj.lib
20 ; RUN: llvm-ar rcs %t.obj.lib %t.wrap.obj %t.other.obj
22 ;; This test verifies that -wrap works correctly for inter-module references to
23 ;; the wrapped symbol, when LTO or ThinLTO is involved. It checks for various
24 ;; combinations of bitcode and regular objects.
27 ; RUN: lld-link -out:%t.bc-bc.exe %t.main.bc -libpath:%T %t.bc.lib -entry:entry -subsystem:console -wrap:bar -debug:symtab -lldsavetemps
28 ; RUN: llvm-objdump -d %t.bc-bc.exe | FileCheck %s --check-prefixes=CHECK,JMP
31 ; RUN: lld-link -out:%t.bc-obj.exe %t.main.bc -libpath:%T %t.obj.lib -entry:entry -subsystem:console -wrap:bar -debug:symtab -lldsavetemps
32 ; RUN: llvm-objdump -d %t.bc-obj.exe | FileCheck %s --check-prefixes=CHECK,JMP
35 ; RUN: lld-link -out:%t.obj-bc.exe %t.main.obj -libpath:%T %t.bc.lib -entry:entry -subsystem:console -wrap:bar -debug:symtab -lldsavetemps
36 ; RUN: llvm-objdump -d %t.obj-bc.exe | FileCheck %s --check-prefixes=CHECK,CALL
39 ; RUN: lld-link -out:%t.thin-thin.exe %t.main.thin -libpath:%T %t.thin.lib -entry:entry -subsystem:console -wrap:bar -debug:symtab -lldsavetemps
40 ; RUN: llvm-objdump -d %t.thin-thin.exe | FileCheck %s --check-prefixes=CHECK,JMP
43 ; RUN: lld-link -out:%t.thin-obj.exe %t.main.thin -libpath:%T %t.obj.lib -entry:entry -subsystem:console -wrap:bar -debug:symtab -lldsavetemps
44 ; RUN: llvm-objdump -d %t.thin-obj.exe | FileCheck %s --check-prefixes=CHECK,JMP
47 ; RUN: lld-link -out:%t.obj-thin.exe %t.main.obj -libpath:%T %t.thin.lib -entry:entry -subsystem:console -wrap:bar -debug:symtab -lldsavetemps
48 ; RUN: llvm-objdump -d %t.obj-thin.exe | FileCheck %s --check-prefixes=CHECK,CALL
50 ;; Make sure that calls in entry() are not eliminated and that bar is
51 ;; routed to __wrap_bar.
54 ; JMP: jmp {{.*}}<__wrap_bar>
55 ; CALL: callq {{.*}}<__wrap_bar>
58 target datalayout = "e-m:w-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
59 target triple = "x86_64-w64-windows-gnu"
63 define void @entry() {
69 target datalayout = "e-m:w-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
70 target triple = "x86_64-w64-windows-gnu"
74 define void @__wrap_bar() {
80 target datalayout = "e-m:w-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
81 target triple = "x86_64-w64-windows-gnu"
83 define void @other() {