aboutsummaryrefslogtreecommitdiff
path: root/test/COFF/msvclto-archive.ll
diff options
context:
space:
mode:
Diffstat (limited to 'test/COFF/msvclto-archive.ll')
-rw-r--r--test/COFF/msvclto-archive.ll39
1 files changed, 39 insertions, 0 deletions
diff --git a/test/COFF/msvclto-archive.ll b/test/COFF/msvclto-archive.ll
new file mode 100644
index 000000000000..047b19e76ddf
--- /dev/null
+++ b/test/COFF/msvclto-archive.ll
@@ -0,0 +1,39 @@
+;; Make sure we re-create archive files to strip bitcode files.
+
+;; Do not create empty archives because the MSVC linker
+;; doesn't support them.
+; RUN: llvm-as -o %t.obj %s
+; RUN: rm -f %t-main1.a
+; RUN: llvm-ar cru %t-main1.a %t.obj
+; RUN: mkdir -p %t.dir
+; RUN: llvm-mc -triple=x86_64-pc-windows-msvc -filetype=obj -o %t.dir/bitcode.obj %p/Inputs/msvclto.s
+; RUN: lld-link %t-main1.a %t.dir/bitcode.obj /msvclto /out:%t.exe /opt:lldlto=1 /opt:icf \
+; RUN: /entry:main /verbose > %t.log || true
+; RUN: FileCheck -check-prefix=BC %s < %t.log
+; BC-NOT: Creating a temporary archive for
+
+; RUN: rm -f %t-main2.a
+; RUN: llvm-ar cru %t-main2.a %t.dir/bitcode.obj
+; RUN: lld-link %t.obj %t-main2.a /msvclto /out:%t.exe /opt:lldlto=1 /opt:icf \
+; RUN: /entry:main /verbose > %t.log || true
+; RUN: FileCheck -check-prefix=OBJ %s < %t.log
+; OBJ-NOT: Creating a temporary archive
+
+;; Make sure that we always rebuild thin archives because
+;; the MSVC linker doesn't support thin archives.
+; RUN: rm -f %t-main3.a
+; RUN: llvm-ar cruT %t-main3.a %t.dir/bitcode.obj
+; RUN: lld-link %t.obj %t-main3.a /msvclto /out:%t.exe /opt:lldlto=1 /opt:icf \
+; RUN: /entry:main /verbose > %t.log || true
+; RUN: FileCheck -check-prefix=THIN %s < %t.log
+; THIN: Creating a temporary archive
+
+target datalayout = "e-m:w-i64:64-f80:128-n8:16:32:64-S128"
+target triple = "x86_64-pc-windows-msvc"
+
+declare void @foo()
+
+define i32 @main() {
+ call void @foo()
+ ret i32 0
+}