88 lines · plain
1; REQUIRES: x862; RUN: split-file %s %t.dir3;; LTO4; RUN: llvm-as %t.dir/main.ll -o %t.main.bc5; RUN: llvm-as %t.dir/wrap.ll -o %t.wrap.bc6; RUN: llvm-as %t.dir/other.ll -o %t.other.bc7; RUN: rm -f %t.bc.lib8; RUN: llvm-ar rcs %t.bc.lib %t.wrap.bc %t.other.bc9;; ThinLTO10; RUN: opt -module-summary %t.dir/main.ll -o %t.main.thin11; RUN: opt -module-summary %t.dir/wrap.ll -o %t.wrap.thin12; RUN: opt -module-summary %t.dir/other.ll -o %t.other.thin13; RUN: rm -f %t.thin.lib14; RUN: llvm-ar rcs %t.thin.lib %t.wrap.thin %t.other.thin15;; Object16; RUN: llc %t.dir/main.ll -o %t.main.obj --filetype=obj17; RUN: llc %t.dir/wrap.ll -o %t.wrap.obj --filetype=obj18; RUN: llc %t.dir/other.ll -o %t.other.obj --filetype=obj19; RUN: rm -f %t.obj.lib20; RUN: llvm-ar rcs %t.obj.lib %t.wrap.obj %t.other.obj21 22;; This test verifies that -wrap works correctly for inter-module references to23;; the wrapped symbol, when LTO or ThinLTO is involved. It checks for various24;; combinations of bitcode and regular objects.25 26; RUN: mkdir -p %t.dir27 28;; LTO + LTO29; RUN: lld-link -out:%t.bc-bc.exe %t.main.bc -libpath:%t.dir %t.bc.lib -entry:entry -subsystem:console -wrap:bar -debug:symtab -lldsavetemps30; RUN: llvm-objdump -d %t.bc-bc.exe | FileCheck %s --check-prefixes=CHECK,JMP31 32;; LTO + Object33; RUN: lld-link -out:%t.bc-obj.exe %t.main.bc -libpath:%t.dir %t.obj.lib -entry:entry -subsystem:console -wrap:bar -debug:symtab -lldsavetemps34; RUN: llvm-objdump -d %t.bc-obj.exe | FileCheck %s --check-prefixes=CHECK,JMP35 36;; Object + LTO37; RUN: lld-link -out:%t.obj-bc.exe %t.main.obj -libpath:%t.dir %t.bc.lib -entry:entry -subsystem:console -wrap:bar -debug:symtab -lldsavetemps38; RUN: llvm-objdump -d %t.obj-bc.exe | FileCheck %s --check-prefixes=CHECK,CALL39 40;; ThinLTO + ThinLTO41; RUN: lld-link -out:%t.thin-thin.exe %t.main.thin -libpath:%t.dir %t.thin.lib -entry:entry -subsystem:console -wrap:bar -debug:symtab -lldsavetemps42; RUN: llvm-objdump -d %t.thin-thin.exe | FileCheck %s --check-prefixes=CHECK,JMP43 44;; ThinLTO + Object45; RUN: lld-link -out:%t.thin-obj.exe %t.main.thin -libpath:%t.dir %t.obj.lib -entry:entry -subsystem:console -wrap:bar -debug:symtab -lldsavetemps46; RUN: llvm-objdump -d %t.thin-obj.exe | FileCheck %s --check-prefixes=CHECK,JMP47 48;; Object + ThinLTO49; RUN: lld-link -out:%t.obj-thin.exe %t.main.obj -libpath:%t.dir %t.thin.lib -entry:entry -subsystem:console -wrap:bar -debug:symtab -lldsavetemps50; RUN: llvm-objdump -d %t.obj-thin.exe | FileCheck %s --check-prefixes=CHECK,CALL51 52;; Make sure that calls in entry() are not eliminated and that bar is53;; routed to __wrap_bar.54 55; CHECK: <entry>:56; JMP: jmp {{.*}}<__wrap_bar>57; CALL: callq {{.*}}<__wrap_bar>58 59;--- main.ll60target datalayout = "e-m:w-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"61target triple = "x86_64-w64-windows-gnu"62 63declare void @bar()64 65define void @entry() {66 call void @bar()67 ret void68}69 70;--- wrap.ll71target datalayout = "e-m:w-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"72target triple = "x86_64-w64-windows-gnu"73 74declare void @other()75 76define void @__wrap_bar() {77 call void @other()78 ret void79}80 81;--- other.ll82target datalayout = "e-m:w-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"83target triple = "x86_64-w64-windows-gnu"84 85define void @other() {86 ret void87}88