summaryrefslogtreecommitdiff
path: root/test/COFF
diff options
context:
space:
mode:
Diffstat (limited to 'test/COFF')
-rw-r--r--test/COFF/Inputs/bar.ll6
-rw-r--r--test/COFF/Inputs/msvclto.s3
-rw-r--r--test/COFF/Inputs/thinlto-mangled-qux.ll28
-rw-r--r--test/COFF/def-name.test28
-rw-r--r--test/COFF/driver-windows.test3
-rw-r--r--test/COFF/error-limit.test29
-rw-r--r--test/COFF/export32.test10
-rw-r--r--test/COFF/hello32.test5
-rw-r--r--test/COFF/include-lto.ll24
-rw-r--r--test/COFF/invalid-debug-type.test5
-rw-r--r--test/COFF/lldmap.test9
-rw-r--r--test/COFF/lto-comdat.ll69
-rw-r--r--test/COFF/lto-debug-pass-arguments.ll16
-rw-r--r--test/COFF/lto-parallel.ll8
-rw-r--r--test/COFF/msvclto-archive.ll39
-rw-r--r--test/COFF/msvclto.ll18
-rw-r--r--test/COFF/nopdb.test14
-rw-r--r--test/COFF/pdb-none.test13
-rw-r--r--test/COFF/pdb.test222
-rw-r--r--test/COFF/rsds.test25
-rw-r--r--test/COFF/savetemps.ll28
-rw-r--r--test/COFF/thinlto-archives.ll22
-rw-r--r--test/COFF/thinlto-mangled.ll16
-rw-r--r--test/COFF/thinlto.ll18
-rw-r--r--test/COFF/weak-external.test5
-rw-r--r--test/COFF/weak-external3.test10
26 files changed, 393 insertions, 280 deletions
diff --git a/test/COFF/Inputs/bar.ll b/test/COFF/Inputs/bar.ll
new file mode 100644
index 0000000000000..4aed5d22a9e0e
--- /dev/null
+++ b/test/COFF/Inputs/bar.ll
@@ -0,0 +1,6 @@
+target datalayout = "e-m:w-i64:64-f80:128-n8:16:32:64-S128"
+target triple = "x86_64-pc-windows-msvc"
+
+define void @bar() {
+ ret void
+}
diff --git a/test/COFF/Inputs/msvclto.s b/test/COFF/Inputs/msvclto.s
new file mode 100644
index 0000000000000..a69f870a1b60e
--- /dev/null
+++ b/test/COFF/Inputs/msvclto.s
@@ -0,0 +1,3 @@
+.globl foo
+foo:
+ret
diff --git a/test/COFF/Inputs/thinlto-mangled-qux.ll b/test/COFF/Inputs/thinlto-mangled-qux.ll
new file mode 100644
index 0000000000000..4c9cc8e9e742b
--- /dev/null
+++ b/test/COFF/Inputs/thinlto-mangled-qux.ll
@@ -0,0 +1,28 @@
+target datalayout = "e-m:w-i64:64-f80:128-n8:16:32:64-S128"
+target triple = "x86_64-pc-windows-msvc19.0.24215"
+
+%class.baz = type { %class.bar }
+%class.bar = type { i32 (...)** }
+
+$"\01?x@bar@@UEBA_NXZ" = comdat any
+
+$"\01??_7baz@@6B@" = comdat any
+
+$"\01??_Gbaz@@UEAAPEAXI@Z" = comdat any
+
+@"\01??_7baz@@6B@" = linkonce_odr unnamed_addr constant { [2 x i8*] } { [2 x i8*] [i8* bitcast (i8* (%class.baz*, i32)* @"\01??_Gbaz@@UEAAPEAXI@Z" to i8*), i8* bitcast (i1 (%class.bar*)* @"\01?x@bar@@UEBA_NXZ" to i8*)] }, comdat, !type !0, !type !1
+
+define void @"\01?qux@@YAXXZ"() local_unnamed_addr {
+ ret void
+}
+
+define linkonce_odr i8* @"\01??_Gbaz@@UEAAPEAXI@Z"(%class.baz* %this, i32 %should_call_delete) unnamed_addr comdat {
+ ret i8* null
+}
+
+define linkonce_odr zeroext i1 @"\01?x@bar@@UEBA_NXZ"(%class.bar* %this) unnamed_addr comdat {
+ ret i1 false
+}
+
+!0 = !{i64 0, !"?AVbar@@"}
+!1 = !{i64 0, !"?AVbaz@@"}
diff --git a/test/COFF/def-name.test b/test/COFF/def-name.test
new file mode 100644
index 0000000000000..c48424a1bff01
--- /dev/null
+++ b/test/COFF/def-name.test
@@ -0,0 +1,28 @@
+# REQUIRES: winres
+
+# RUN: rm -rf %t
+# RUN: mkdir -p %t
+# RUN: cd %t
+# RUN: yaml2obj < %p/Inputs/ret42.yaml > in.obj
+
+# RUN: lld-link /entry:main in.obj
+# RUN: lld-link /entry:main /dll in.obj
+
+# RUN: echo -e "NAME foo\n" > fooexe.def
+# RUN: echo -e "LIBRARY foo\n" > foodll.def
+# RUN: lld-link /entry:main /def:fooexe.def in.obj
+# RUN: lld-link /entry:main /def:foodll.def /dll in.obj
+
+# RUN: lld-link /entry:main /out:bar.exe /def:fooexe.def in.obj
+# RUN: lld-link /entry:main /out:bar.dll /def:foodll.def /dll in.obj
+
+# RUN: llvm-readobj in.exe | FileCheck %s
+# RUN: llvm-readobj in.dll | FileCheck %s
+
+# RUN: llvm-readobj foo.exe | FileCheck %s
+# RUN: llvm-readobj foo.dll | FileCheck %s
+
+# RUN: llvm-readobj bar.exe | FileCheck %s
+# RUN: llvm-readobj bar.dll | FileCheck %s
+
+CHECK: File:
diff --git a/test/COFF/driver-windows.test b/test/COFF/driver-windows.test
new file mode 100644
index 0000000000000..1b93a53bddb34
--- /dev/null
+++ b/test/COFF/driver-windows.test
@@ -0,0 +1,3 @@
+# REQUIRES: system-windows
+# RUN: not LLD-LINK 2>&1 | FileCheck %s
+CHECK: no input files
diff --git a/test/COFF/error-limit.test b/test/COFF/error-limit.test
new file mode 100644
index 0000000000000..3eebd12aaabea
--- /dev/null
+++ b/test/COFF/error-limit.test
@@ -0,0 +1,29 @@
+RUN: not lld-link 01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 18 19 20 \
+RUN: 21 22 2>&1 | FileCheck -check-prefix=DEFAULT %s
+
+DEFAULT: could not open 01
+DEFAULT: could not open 20
+DEFAULT-NEXT: too many errors emitted, stopping now (use /ERRORLIMIT:0 to see all errors)
+DEFAULT-NOT: could not open 21
+
+RUN: not lld-link /ERRORLIMIT:5 01 02 03 04 05 06 07 08 09 10 2>&1 \
+RUN: | FileCheck -check-prefix=LIMIT5 %s
+
+LIMIT5: could not open 01
+LIMIT5: could not open 05
+LIMIT5-NEXT: too many errors emitted, stopping now (use /ERRORLIMIT:0 to see all errors)
+LIMIT5-NOT: could not open 06
+
+RUN: not lld-link /ERRORLIMIT:0 01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 \
+RUN: 16 17 18 19 20 21 22 2>&1 | FileCheck -check-prefix=UNLIMITED %s
+
+UNLIMITED: could not open 01
+UNLIMITED: could not open 20
+UNLIMITED: could not open 21
+UNLIMITED: could not open 22
+UNLIMITED-NOT: too many errors emitted, stopping now (use /ERRORLIMIT:0 to see all errors)
+
+RUN: not lld-link /ERRORLIMIT:XYZ 01 02 03 04 05 06 07 08 09 10 11 12 13 14 \
+RUN: 15 16 17 18 19 20 21 22 2>&1 | FileCheck -check-prefix=WRONG %s
+
+WRONG: /ERRORLIMIT: number expected, but got XYZ
diff --git a/test/COFF/export32.test b/test/COFF/export32.test
index 79f5daf62dbfa..83de18b11624e 100644
--- a/test/COFF/export32.test
+++ b/test/COFF/export32.test
@@ -73,6 +73,16 @@
# CHECK6: duplicate /export option: _exportfn2
# CHECK6-NOT: duplicate /export option: _exportfn1
+# RUN: lld-link /out:%t.dll /dll %t.obj /export:foo=mangled
+# RUN: llvm-objdump -p %t.dll | FileCheck -check-prefix=CHECK7 %s
+
+# CHECK7: Export Table:
+# CHECK7: DLL name: export32.test.tmp.dll
+# CHECK7: Ordinal RVA Name
+# CHECK7-NEXT: 0 0
+# CHECK7-NEXT: 1 0
+# CHECK7-NEXT: 2 0x1010 foo
+
--- !COFF
header:
Machine: IMAGE_FILE_MACHINE_I386
diff --git a/test/COFF/hello32.test b/test/COFF/hello32.test
index 4307d4bf89a9f..b7bc887d46eb5 100644
--- a/test/COFF/hello32.test
+++ b/test/COFF/hello32.test
@@ -1,6 +1,6 @@
# RUN: yaml2obj < %p/Inputs/hello32.yaml > %t.obj
# RUN: lld-link %t.obj %p/Inputs/std32.lib /subsystem:console \
-# RUN: /entry:main@0 /out:%t.exe
+# RUN: /entry:main@0 /out:%t.exe /appcontainer
# RUN: llvm-readobj -file-headers %t.exe | FileCheck -check-prefix=HEADER %s
# RUN: llvm-readobj -coff-imports %t.exe | FileCheck -check-prefix=IMPORTS %s
# RUN: llvm-readobj -coff-basereloc %t.exe | FileCheck -check-prefix=BASEREL %s
@@ -41,7 +41,8 @@ HEADER-NEXT: MinorSubsystemVersion: 0
HEADER-NEXT: SizeOfImage: 16896
HEADER-NEXT: SizeOfHeaders: 512
HEADER-NEXT: Subsystem: IMAGE_SUBSYSTEM_WINDOWS_CUI (0x3)
-HEADER-NEXT: Characteristics [ (0x8140)
+HEADER-NEXT: Characteristics [ (0x9140)
+HEADER-NEXT: IMAGE_DLL_CHARACTERISTICS_APPCONTAINER (0x1000)
HEADER-NEXT: IMAGE_DLL_CHARACTERISTICS_DYNAMIC_BASE (0x40)
HEADER-NEXT: IMAGE_DLL_CHARACTERISTICS_NX_COMPAT (0x100)
HEADER-NEXT: IMAGE_DLL_CHARACTERISTICS_TERMINAL_SERVER_AWARE (0x8000)
diff --git a/test/COFF/include-lto.ll b/test/COFF/include-lto.ll
new file mode 100644
index 0000000000000..ab9f85f5719e3
--- /dev/null
+++ b/test/COFF/include-lto.ll
@@ -0,0 +1,24 @@
+; RUN: llvm-as -o %t.obj %s
+; RUN: lld-link /dll /out:%t.dll %t.obj
+; RUN: llvm-objdump -d %t.dll | FileCheck %s
+
+; Checks that code for foo is emitted, as required by the /INCLUDE directive.
+; CHECK: xorl %eax, %eax
+; CHECK-NEXT: retq
+
+target datalayout = "e-m:w-i64:64-f80:128-n8:16:32:64-S128"
+target triple = "x86_64-pc-windows-msvc"
+
+define void @_DllMainCRTStartup() {
+ ret void
+}
+
+define i32 @foo() {
+ ret i32 0
+}
+
+!llvm.module.flags = !{!0}
+
+!0 = !{i32 6, !"Linker Options", !1}
+!1 = !{!2}
+!2 = !{!"/INCLUDE:foo"}
diff --git a/test/COFF/invalid-debug-type.test b/test/COFF/invalid-debug-type.test
new file mode 100644
index 0000000000000..e48b3fdd2e06a
--- /dev/null
+++ b/test/COFF/invalid-debug-type.test
@@ -0,0 +1,5 @@
+# RUN: yaml2obj < %p/Inputs/pdb1.yaml > %t1.obj
+# RUN: yaml2obj < %p/Inputs/pdb2.yaml > %t2.obj
+# RUN: lld-link /debug /debugtype:invalid /pdb:%t.pdb /dll /out:%t.dll /entry:main /nodefaultlib \
+# RUN: /debugpdb %t1.obj %t2.obj
+
diff --git a/test/COFF/lldmap.test b/test/COFF/lldmap.test
index eb61f0e5a6c2e..69080fd639abf 100644
--- a/test/COFF/lldmap.test
+++ b/test/COFF/lldmap.test
@@ -4,7 +4,8 @@
# RUN: lld-link /out:%T/bar.exe /entry:main /lldmap %t.obj
# RUN: FileCheck %s < %T/bar.map
-# CHECK: .obj:
-# CHECK-NEXT: 140001000 .text$mn
-# CHECK-NEXT: 140001000 .data
-# CHECK-NEXT: 140001000 main
+# CHECK: Address Size Align Out In File Symbol
+# CHECK-NEXT: 00001000 00000006 4096 .text
+# CHECK-NEXT: 00001000 00000006 16 .text$mn
+# CHECK-NEXT: 00001000 00000006 16 {{.*}}lldmap.test.tmp.obj
+# CHECK-NEXT: 00001000 00000006 0 main
diff --git a/test/COFF/lto-comdat.ll b/test/COFF/lto-comdat.ll
index aaa7a16c4afba..b255f69d1ab55 100644
--- a/test/COFF/lto-comdat.ll
+++ b/test/COFF/lto-comdat.ll
@@ -10,6 +10,8 @@
; RUN: rm -f %T/comdat.lib
; RUN: llvm-ar cru %T/comdat.lib %T/comdat1.obj %T/comdat2.obj
+; Check that, when we use an LTO main with LTO objects, we optimize away all
+; of f1, f2, and comdat.
; RUN: lld-link /out:%T/comdat-main.exe /entry:main /subsystem:console %T/comdat-main.lto.obj %T/comdat1.lto.obj %T/comdat2.lto.obj
; RUN: llvm-readobj -file-headers %T/comdat-main.exe | FileCheck -check-prefix=HEADERS-11 %s
; RUN: llvm-objdump -d %T/comdat-main.exe | FileCheck -check-prefix=TEXT-11 %s
@@ -17,6 +19,9 @@
; RUN: llvm-readobj -file-headers %T/comdat-main.exe | FileCheck -check-prefix=HEADERS-11 %s
; RUN: llvm-objdump -d %T/comdat-main.exe | FileCheck -check-prefix=TEXT-11 %s
+; Check that, when we use a non-LTO main with LTO objects, we pick the comdat
+; implementation in LTO, elide calls to it from inside LTO, and retain the
+; call to comdat from main.
; RUN: lld-link /out:%T/comdat-main.exe /entry:main /subsystem:console %T/comdat-main.obj %T/comdat1.lto.obj %T/comdat2.lto.obj
; RUN: llvm-readobj -file-headers %T/comdat-main.exe | FileCheck -check-prefix=HEADERS-01 %s
; RUN: llvm-objdump -d %T/comdat-main.exe | FileCheck -check-prefix=TEXT-01 %s
@@ -24,6 +29,9 @@
; RUN: llvm-readobj -file-headers %T/comdat-main.exe | FileCheck -check-prefix=HEADERS-01 %s
; RUN: llvm-objdump -d %T/comdat-main.exe | FileCheck -check-prefix=TEXT-01 %s
+; Check that, when we use an LTO main with non-LTO objects, we pick the comdat
+; implementation in LTO, elide the call to it from inside LTO, and keep the
+; calls to comdat from the non-LTO objects.
; RUN: lld-link /out:%T/comdat-main.exe /entry:main /subsystem:console %T/comdat-main.lto.obj %T/comdat1.obj %T/comdat2.obj
; RUN: llvm-readobj -file-headers %T/comdat-main.exe | FileCheck -check-prefix=HEADERS-10 %s
; RUN: llvm-objdump -d %T/comdat-main.exe | FileCheck -check-prefix=TEXT-10 %s
@@ -46,70 +54,39 @@
; TEXT-01-NEXT: callq 13
; TEXT-01-NEXT: xorl %eax, %eax
; TEXT-01-NEXT: addq $40, %rsp
-; TEXT-01-NEXT: retq
-; TEXT-01-NEXT: int3
-; TEXT-01-NEXT: int3
-; TEXT-01-NEXT: int3
-; TEXT-01-NEXT: int3
-; TEXT-01-NEXT: int3
-; TEXT-01-NEXT: int3
-; TEXT-01-NEXT: retq
-; TEXT-01-NEXT: int3
-; TEXT-01-NEXT: int3
-; TEXT-01-NEXT: int3
-; TEXT-01-NEXT: int3
-; TEXT-01-NEXT: int3
-; TEXT-01-NEXT: int3
-; TEXT-01-NEXT: int3
-; TEXT-01-NEXT: int3
-; TEXT-01-NEXT: int3
-; TEXT-01-NEXT: int3
-; TEXT-01-NEXT: int3
-; TEXT-01-NEXT: int3
-; TEXT-01-NEXT: int3
-; TEXT-01-NEXT: int3
-; TEXT-01-NEXT: int3
-; TEXT-01-NEXT: retq
-; TEXT-01-NEXT: nopw %cs:(%rax,%rax)
-; TEXT-01-NEXT: retq
+; TEXT-01: retq
+; TEXT-01-NOT: callq
+; TEXT-01: retq
+; TEXT-01-NOT: callq
+; TEXT-01: retq
+; TEXT-01-NOT: callq
+; TEXT-01: retq
+; TEXT-01-NOT: {{.}}
-; HEADERS-10: AddressOfEntryPoint: 0x2030
+; HEADERS-10: AddressOfEntryPoint: 0x2020
; TEXT-10: Disassembly of section .text:
; TEXT-10-NEXT: .text:
; TEXT-10-NEXT: subq $40, %rsp
-; TEXT-10-NEXT: callq 7
+; TEXT-10-NEXT: callq 55
; TEXT-10-NEXT: nop
; TEXT-10-NEXT: addq $40, %rsp
; TEXT-10-NEXT: retq
; TEXT-10-NEXT: int3
-; TEXT-10-NEXT: retq
-; TEXT-10-NEXT: int3
-; TEXT-10-NEXT: int3
-; TEXT-10-NEXT: int3
-; TEXT-10-NEXT: int3
-; TEXT-10-NEXT: int3
-; TEXT-10-NEXT: int3
-; TEXT-10-NEXT: int3
-; TEXT-10-NEXT: int3
-; TEXT-10-NEXT: int3
-; TEXT-10-NEXT: int3
-; TEXT-10-NEXT: int3
-; TEXT-10-NEXT: int3
-; TEXT-10-NEXT: int3
-; TEXT-10-NEXT: int3
-; TEXT-10-NEXT: int3
; TEXT-10-NEXT: subq $40, %rsp
-; TEXT-10-NEXT: callq -25
+; TEXT-10-NEXT: callq 39
; TEXT-10-NEXT: nop
; TEXT-10-NEXT: addq $40, %rsp
; TEXT-10-NEXT: retq
; TEXT-10-NEXT: int3
; TEXT-10-NEXT: subq $40, %rsp
-; TEXT-10-NEXT: callq -57
+; TEXT-10-NEXT: callq -41
; TEXT-10-NEXT: callq -30
; TEXT-10-NEXT: xorl %eax, %eax
; TEXT-10-NEXT: addq $40, %rsp
; TEXT-10-NEXT: retq
+; TEXT-10-NOT: callq
+; TEXT-10: retq
+; TEXT-10-NOT: {{.}}
target datalayout = "e-m:w-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-windows-msvc"
diff --git a/test/COFF/lto-debug-pass-arguments.ll b/test/COFF/lto-debug-pass-arguments.ll
new file mode 100644
index 0000000000000..4381590ff1306
--- /dev/null
+++ b/test/COFF/lto-debug-pass-arguments.ll
@@ -0,0 +1,16 @@
+; REQUIRES: x86
+; RUN: llvm-as %s -o %t.obj
+; RUN: lld-link /dll /out:%t.dll %t.obj /mllvm:-debug-pass=Arguments 2>&1 | FileCheck %s
+
+target datalayout = "e-m:w-i64:64-f80:128-n8:16:32:64-S128"
+target triple = "x86_64-pc-windows-msvc"
+
+define void @dummy() {
+ ret void
+}
+
+define void @_DllMainCRTStartup() {
+ ret void
+}
+
+; CHECK: Pass Arguments:
diff --git a/test/COFF/lto-parallel.ll b/test/COFF/lto-parallel.ll
index 2303797019a5f..449e3a01a8536 100644
--- a/test/COFF/lto-parallel.ll
+++ b/test/COFF/lto-parallel.ll
@@ -1,18 +1,18 @@
; RUN: llvm-as -o %t.obj %s
-; RUN: lld-link /out:%t.exe /entry:foo /include:bar /opt:lldltojobs=2 /subsystem:console /lldmap:%t.map %t.obj
+; RUN: lld-link /out:%t.exe /entry:foo /include:bar /opt:lldltopartitions=2 /subsystem:console /lldmap:%t.map %t.obj
; RUN: FileCheck %s < %t.map
target datalayout = "e-m:w-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-windows-msvc"
-; CHECK: <lto object>:
-; CHECK: foo
+; CHECK: lto.tmp
+; CHECK-NEXT: foo
define void @foo() {
call void @bar()
ret void
}
-; CHECK: <lto object>:
+; CHECK: lto.tmp
; CHECK: bar
define void @bar() {
call void @foo()
diff --git a/test/COFF/msvclto-archive.ll b/test/COFF/msvclto-archive.ll
new file mode 100644
index 0000000000000..047b19e76ddfa
--- /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
+}
diff --git a/test/COFF/msvclto.ll b/test/COFF/msvclto.ll
new file mode 100644
index 0000000000000..e8a6b5c49ce94
--- /dev/null
+++ b/test/COFF/msvclto.ll
@@ -0,0 +1,18 @@
+; RUN: llvm-as -o %t.obj %s
+; 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.obj %t.dir/bitcode.obj /msvclto /out:%t.exe /opt:lldlto=1 /opt:icf \
+; RUN: /entry:main /verbose > %t.log || true
+; RUN: FileCheck %s < %t.log
+
+; CHECK: /opt:icf /entry:main /verbose
+
+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
+}
diff --git a/test/COFF/nopdb.test b/test/COFF/nopdb.test
new file mode 100644
index 0000000000000..29797bbf93106
--- /dev/null
+++ b/test/COFF/nopdb.test
@@ -0,0 +1,14 @@
+# Check that /debug creates %t.pdb.
+# RUN: rm -f %t.pdb
+# RUN: lld-link /debug /entry:main /out:%t.exe %p/Inputs/ret42.obj
+# RUN: ls %t.pdb
+
+# Check that /debug /nopdb does not create %t.pdb.
+# RUN: rm -f %t.pdb
+# RUN: lld-link /debug /nopdb /entry:main /out:%t.exe %p/Inputs/ret42.obj
+# RUN: not ls %t.pdb
+
+# Check that /debug /nopdb /pdb:%t.pdb does not create %t.pdb.
+# RUN: rm -f %t.pdb
+# RUN: lld-link /debug /nopdb /pdb:%t.pdb /entry:main /out:%t.exe %p/Inputs/ret42.obj
+# RUN: not ls %t.pdb
diff --git a/test/COFF/pdb-none.test b/test/COFF/pdb-none.test
new file mode 100644
index 0000000000000..480ff2a4ace3a
--- /dev/null
+++ b/test/COFF/pdb-none.test
@@ -0,0 +1,13 @@
+# RUN: yaml2obj < %p/Inputs/pdb1.yaml > %t1.obj
+# RUN: yaml2obj < %p/Inputs/pdb2.yaml > %t2.obj
+# RUN: lld-link /debug /debugtype:pdata /pdb:%t.pdb /dll /out:%t.dll /entry:main /nodefaultlib \
+# RUN: /debugpdb %t1.obj %t2.obj
+
+# RUN: llvm-pdbdump pdb2yaml -pdb-stream %t.pdb | FileCheck %s
+
+# CHECK: PdbStream:
+# CHECK-NEXT: Age: 0
+# CHECK-NEXT: Guid: '{00000000-0000-0000-0000-000000000000}'
+# CHECK-NEXT: Signature: 0
+# CHECK-NEXT: Version: VC70
+
diff --git a/test/COFF/pdb.test b/test/COFF/pdb.test
index 5939b825f9a28..aa14d290c737d 100644
--- a/test/COFF/pdb.test
+++ b/test/COFF/pdb.test
@@ -6,32 +6,28 @@
# RUN: llvm-pdbdump pdb2yaml -stream-metadata -stream-directory -pdb-stream \
# RUN: -dbi-stream -ipi-stream -tpi-stream %t.pdb | FileCheck %s
+# RUN: llvm-pdbdump raw -modules -section-map -section-headers -section-contribs \
+# RUN: -tpi-records %t.pdb | FileCheck -check-prefix RAW %s
+
# CHECK: MSF:
# CHECK-NEXT: SuperBlock:
# CHECK-NEXT: BlockSize: 4096
# CHECK-NEXT: FreeBlockMap: 1
-# CHECK-NEXT: NumBlocks: 10
-# CHECK-NEXT: NumDirectoryBytes: 48
+# CHECK-NEXT: NumBlocks:
+# CHECK-NEXT: NumDirectoryBytes:
# CHECK-NEXT: Unknown1: 0
-# CHECK-NEXT: BlockMapAddr: 3
-# CHECK-NEXT: NumDirectoryBlocks: 1
-# CHECK-NEXT: DirectoryBlocks: [ 9 ]
-# CHECK-NEXT: NumStreams: 6
-# CHECK-NEXT: FileSize: 40960
-# CHECK-NEXT: StreamSizes: [ 0, 48, 736, 390, 56, 160 ]
+# CHECK-NEXT: BlockMapAddr:
+# CHECK-NEXT: NumDirectoryBlocks:
+# CHECK-NEXT: DirectoryBlocks:
+# CHECK-NEXT: NumStreams:
+# CHECK-NEXT: FileSize:
+# CHECK-NEXT: StreamSizes:
# CHECK-NEXT: StreamMap:
-# CHECK-NEXT: - Stream: [ ]
-# CHECK-NEXT: - Stream: [ 5 ]
-# CHECK-NEXT: - Stream: [ 7 ]
-# CHECK-NEXT: - Stream: [ 6 ]
-# CHECK-NEXT: - Stream: [ 8 ]
-# CHECK-NEXT: - Stream: [ 4 ]
-# CHECK-NEXT: PdbStream:
+# CHECK: PdbStream:
# CHECK-NEXT: Age: 1
# CHECK-NEXT: Guid:
# CHECK-NEXT: Signature: 0
# CHECK-NEXT: Version: VC70
-# CHECK-NEXT: NamedStreams:
# CHECK-NEXT: DbiStream:
# CHECK-NEXT: VerHeader: V110
# CHECK-NEXT: Age: 1
@@ -67,6 +63,9 @@
# CHECK-NEXT: Options: [ None ]
# CHECK-NEXT: ParameterCount: 0
# CHECK-NEXT: ArgumentList: 4099
+# CHECK-NEXT: IpiStream:
+# CHECK-NEXT: Version: VC80
+# CHECK-NEXT: Records:
# CHECK-NEXT: - Kind: LF_FUNC_ID
# CHECK-NEXT: FuncId:
# CHECK-NEXT: ParentScope: 0
@@ -90,11 +89,11 @@
# CHECK-NEXT: Id: 0
# CHECK-NEXT: String: '-Z7 -c -MT -IC:\vs14\VC\INCLUDE -IC:\vs14\VC\ATLMFC\INCLUDE -I"C:\Program Files (x86)\Windows Kits\10\include\10.0.10150.0\ucrt" -I"C:\Program Files (x86)\Windows Kits\NETFXSDK\4.6\include\um" -I"C:\Program Files (x86)\Windows Kits\8.1\include\shared"'
# CHECK-NEXT: - Kind: LF_SUBSTR_LIST
-# CHECK-NEXT: ArgList:
-# CHECK-NEXT: ArgIndices: [ 4105 ]
+# CHECK-NEXT: StringList:
+# CHECK-NEXT: StringIndices: [ 4100 ]
# CHECK-NEXT: - Kind: LF_STRING_ID
# CHECK-NEXT: StringId:
-# CHECK-NEXT: Id: 4106
+# CHECK-NEXT: Id: 4101
# CHECK-NEXT: String: ' -I"C:\Program Files (x86)\Windows Kits\8.1\include\um" -I"C:\Program Files (x86)\Windows Kits\8.1\include\winrt" -TC -X'
# CHECK-NEXT: - Kind: LF_STRING_ID
# CHECK-NEXT: StringId:
@@ -106,58 +105,18 @@
# CHECK-NEXT: String: 'D:\b\vc140.pdb'
# CHECK-NEXT: - Kind: LF_BUILDINFO
# CHECK-NEXT: BuildInfo:
-# CHECK-NEXT: ArgIndices: [ 4103, 4104, 4108, 4109, 4107 ]
+# CHECK-NEXT: ArgIndices: [ 4098, 4099, 4103, 4104, 4102 ]
# CHECK-NEXT: - Kind: LF_STRING_ID
# CHECK-NEXT: StringId:
# CHECK-NEXT: Id: 0
# CHECK-NEXT: String: ret42-sub.c
# CHECK-NEXT: - Kind: LF_BUILDINFO
# CHECK-NEXT: BuildInfo:
-# CHECK-NEXT: ArgIndices: [ 4103, 4104, 4111, 4109, 4107 ]
-# CHECK-NEXT: IpiStream:
-# CHECK-NEXT: Version: VC80
-# CHECK-NEXT: Records:
+# CHECK-NEXT: ArgIndices: [ 4098, 4099, 4106, 4104, 4102 ]
-# RAW: FileHeaders {
-# RAW-NEXT: BlockSize: 4096
-# RAW-NEXT: FreeBlockMap: 1
-# RAW-NEXT: NumBlocks: 10
-# RAW-NEXT: NumDirectoryBytes: 48
-# RAW-NEXT: Unknown1: 0
-# RAW-NEXT: BlockMapAddr: 3
-# RAW-NEXT: NumDirectoryBlocks: 1
-# RAW-NEXT: DirectoryBlocks: [9]
-# RAW-NEXT: NumStreams: 6
-# RAW-NEXT: }
-# RAW-NEXT: Streams [
-# RAW-NEXT: Stream 0: [Old MSF Directory] (0 bytes)
-# RAW-NEXT: Stream 1: [PDB Stream] (48 bytes)
-# RAW-NEXT: Stream 2: [TPI Stream] (736 bytes)
-# RAW-NEXT: Stream 3: [DBI Stream] (390 bytes)
-# RAW-NEXT: Stream 4: [IPI Stream] (56 bytes)
-# RAW-NEXT: Stream 5: [Section Header Data] (160 bytes)
-# RAW-NEXT: ]
-# RAW-NEXT: Msf Free Pages: []
-# RAW-NEXT: Orphaned Pages: []
-# RAW-NEXT: Multiply Used Pages: []
-# RAW-NEXT: Use After Free Pages: []
-# RAW-NEXT: StreamBlocks [
-# RAW-NEXT: Stream 0: []
-# RAW-NEXT: Stream 1: [5]
-# RAW-NEXT: Stream 2: [7]
-# RAW-NEXT: Stream 3: [6]
-# RAW-NEXT: Stream 4: [8]
-# RAW-NEXT: Stream 5: [4]
-# RAW-NEXT: ]
-# RAW-NEXT: PDB Stream {
-# RAW-NEXT: Version: 20000404
-# RAW-NEXT: Signature: 0x0
-# RAW-NEXT: Age: 1
-# RAW-NEXT: Guid: {7EBCCC79-C488-0267-C898-06D7E94A8A10}
-# RAW-NEXT: }
-# RAW-NEXT: Type Info Stream (TPI) {
+# RAW: Type Info Stream (TPI) {
# RAW-NEXT: TPI Version: 20040203
-# RAW-NEXT: Record count: 17
+# RAW-NEXT: Record count: 5
# RAW-NEXT: Records [
# RAW-NEXT: {
# RAW-NEXT: ArgList (0x1000) {
@@ -212,126 +171,9 @@
# RAW-NEXT: ArgListType: (<no type>) (0x1003)
# RAW-NEXT: }
# RAW-NEXT: }
-# RAW-NEXT: {
-# RAW-NEXT: FuncId (0x1005) {
-# RAW-NEXT: TypeLeafKind: LF_FUNC_ID (0x1601)
-# RAW-NEXT: ParentScope: 0x0
-# RAW-NEXT: FunctionType: int (<no type>) (0x1004)
-# RAW-NEXT: Name: main
-# RAW-NEXT: }
-# RAW-NEXT: }
-# RAW-NEXT: {
-# RAW-NEXT: FuncId (0x1006) {
-# RAW-NEXT: TypeLeafKind: LF_FUNC_ID (0x1601)
-# RAW-NEXT: ParentScope: 0x0
-# RAW-NEXT: FunctionType: int () (0x1001)
-# RAW-NEXT: Name: foo
-# RAW-NEXT: }
-# RAW-NEXT: }
-# RAW-NEXT: {
-# RAW-NEXT: StringId (0x1007) {
-# RAW-NEXT: TypeLeafKind: LF_STRING_ID (0x1605)
-# RAW-NEXT: Id: 0x0
-# RAW-NEXT: StringData: D:\b
-# RAW-NEXT: }
-# RAW-NEXT: }
-# RAW-NEXT: {
-# RAW-NEXT: StringId (0x1008) {
-# RAW-NEXT: TypeLeafKind: LF_STRING_ID (0x1605)
-# RAW-NEXT: Id: 0x0
-# RAW-NEXT: StringData: C:\vs14\VC\BIN\amd64\cl.exe
-# RAW-NEXT: }
-# RAW-NEXT: }
-# RAW-NEXT: {
-# RAW-NEXT: StringId (0x1009) {
-# RAW-NEXT: TypeLeafKind: LF_STRING_ID (0x1605)
-# RAW-NEXT: Id: 0x0
-# RAW-NEXT: StringData: -Z7 -c -MT -IC:\vs14\VC\INCLUDE -IC:\vs14\VC\ATLMFC\INCLUDE -I"C:\Program Files (x86)\Windows Kits\10\include\10.0.10150.0\ucrt" -I"C:\Program Files (x86)\Windows Kits\NETFXSDK\4.6\include\um" -I"C:\Program Files (x86)\Windows Kits\8.1\include\shared"
-# RAW-NEXT: }
-# RAW-NEXT: }
-# RAW-NEXT: {
-# RAW-NEXT: StringList (0x100A) {
-# RAW-NEXT: TypeLeafKind: LF_SUBSTR_LIST (0x1604)
-# RAW-NEXT: NumArgs: 1
-# RAW-NEXT: Arguments [
-# RAW-NEXT: ArgType: -Z7 -c -MT -IC:\vs14\VC\INCLUDE -IC:\vs14\VC\ATLMFC\INCLUDE -I"C:\Program Files (x86)\Windows Kits\10\include\10.0.10150.0\ucrt" -I"C:\Program Files (x86)\Windows Kits\NETFXSDK\4.6\include\um" -I"C:\Program Files (x86)\Windows Kits\8.1\include\shared" (0x1009)
-# RAW-NEXT: ]
-# RAW-NEXT: }
-# RAW-NEXT: }
-# RAW-NEXT: {
-# RAW-NEXT: StringId (0x100B) {
-# RAW-NEXT: TypeLeafKind: LF_STRING_ID (0x1605)
-# RAW-NEXT: Id: (-Z7 -c -MT -IC:\vs14\VC\INCLUDE -IC:\vs14\VC\ATLMFC\INCLUDE -I"C:\Program Files (x86)\Windows Kits\10\include\10.0.10150.0\ucrt" -I"C:\Program Files (x86)\Windows Kits\NETFXSDK\4.6\include\um" -I"C:\Program Files (x86)\Windows Kits\8.1\include\shared") (0x100A)
-# RAW-NEXT: StringData: -I"C:\Program Files (x86)\Windows Kits\8.1\include\um" -I"C:\Program Files (x86)\Windows Kits\8.1\include\winrt" -TC -X
-# RAW-NEXT: }
-# RAW-NEXT: }
-# RAW-NEXT: {
-# RAW-NEXT: StringId (0x100C) {
-# RAW-NEXT: TypeLeafKind: LF_STRING_ID (0x1605)
-# RAW-NEXT: Id: 0x0
-# RAW-NEXT: StringData: ret42-main.c
-# RAW-NEXT: }
-# RAW-NEXT: }
-# RAW-NEXT: {
-# RAW-NEXT: StringId (0x100D) {
-# RAW-NEXT: TypeLeafKind: LF_STRING_ID (0x1605)
-# RAW-NEXT: Id: 0x0
-# RAW-NEXT: StringData: D:\b\vc140.pdb
-# RAW-NEXT: }
-# RAW-NEXT: }
-# RAW-NEXT: {
-# RAW-NEXT: BuildInfo (0x100E) {
-# RAW-NEXT: TypeLeafKind: LF_BUILDINFO (0x1603)
-# RAW-NEXT: NumArgs: 5
-# RAW-NEXT: Arguments [
-# RAW-NEXT: ArgType: D:\b (0x1007)
-# RAW-NEXT: ArgType: C:\vs14\VC\BIN\amd64\cl.exe (0x1008)
-# RAW-NEXT: ArgType: ret42-main.c (0x100C)
-# RAW-NEXT: ArgType: D:\b\vc140.pdb (0x100D)
-# RAW-NEXT: ArgType: -I"C:\Program Files (x86)\Windows Kits\8.1\include\um" -I"C:\Program Files (x86)\Windows Kits\8.1\include\winrt" -TC -X (0x100B)
-# RAW-NEXT: ]
-# RAW-NEXT: }
-# RAW-NEXT: }
-# RAW-NEXT: {
-# RAW-NEXT: StringId (0x100F) {
-# RAW-NEXT: TypeLeafKind: LF_STRING_ID (0x1605)
-# RAW-NEXT: Id: 0x0
-# RAW-NEXT: StringData: ret42-sub.c
-# RAW-NEXT: }
-# RAW-NEXT: }
-# RAW-NEXT: {
-# RAW-NEXT: BuildInfo (0x1010) {
-# RAW-NEXT: TypeLeafKind: LF_BUILDINFO (0x1603)
-# RAW-NEXT: NumArgs: 5
-# RAW-NEXT: Arguments [
-# RAW-NEXT: ArgType: D:\b (0x1007)
-# RAW-NEXT: ArgType: C:\vs14\VC\BIN\amd64\cl.exe (0x1008)
-# RAW-NEXT: ArgType: ret42-sub.c (0x100F)
-# RAW-NEXT: ArgType: D:\b\vc140.pdb (0x100D)
-# RAW-NEXT: ArgType: -I"C:\Program Files (x86)\Windows Kits\8.1\include\um" -I"C:\Program Files (x86)\Windows Kits\8.1\include\winrt" -TC -X (0x100B)
-# RAW-NEXT: ]
-# RAW-NEXT: }
-# RAW-NEXT: }
-# RAW-NEXT: Hash {
-# RAW-NEXT: Number of Hash Buckets: 4096
-# RAW-NEXT: Hash Key Size: 4
-# RAW-NEXT: Values: []
-# RAW-NEXT: Type Index Offsets: []
-# RAW-NEXT: Hash Adjustments: []
-# RAW-NEXT: }
-# RAW-NEXT: ]
-# RAW-NEXT: }
-# RAW-NEXT: Type Info Stream (IPI) {
-# RAW-NEXT: IPI Version: 20040203
-# RAW-NEXT: Record count: 0
-# RAW-NEXT: Records [
-# RAW-NEXT: Hash {
-# RAW-NEXT: Number of Hash Buckets: 4096
-# RAW-NEXT: Hash Key Size: 4
-# RAW-NEXT: Values: []
-# RAW-NEXT: Type Index Offsets: []
-# RAW-NEXT: Hash Adjustments: []
-# RAW-NEXT: }
+# RAW-NEXT: TypeIndexOffsets [
+# RAW-NEXT: Index: 0x1000, Offset: 0
+# RAW-NEXT: ]
# RAW-NEXT: ]
# RAW-NEXT: }
# RAW-NEXT: DBI Stream {
@@ -349,18 +191,16 @@
# RAW-NEXT: Modules [
# RAW-NEXT: {
# RAW-NEXT: Name: * Linker *
-# RAW-NEXT: Debug Stream Index: 65535
+# RAW-NEXT: Debug Stream Index: 9
# RAW-NEXT: Object File Name:
# RAW-NEXT: Num Files: 0
# RAW-NEXT: Source File Name Idx: 0
# RAW-NEXT: Pdb File Name Idx: 0
# RAW-NEXT: Line Info Byte Size: 0
# RAW-NEXT: C13 Line Info Byte Size: 0
-# RAW-NEXT: Symbol Byte Size: 0
+# RAW-NEXT: Symbol Byte Size: 4
# RAW-NEXT: Type Server Index: 0
# RAW-NEXT: Has EC Info: No
-# RAW-NEXT: 0 Contributing Source Files [
-# RAW-NEXT: ]
# RAW-NEXT: }
# RAW-NEXT: ]
# RAW-NEXT: }
@@ -488,7 +328,7 @@
# RAW-NEXT: SecName: 65535
# RAW-NEXT: ClassName: 65535
# RAW-NEXT: Offset: 0
-# RAW-NEXT: SecByteLength: 101
+# RAW-NEXT: SecByteLength:
# RAW-NEXT: }
# RAW-NEXT: Entry {
# RAW-NEXT: Flags [ (0x208)
@@ -504,8 +344,6 @@
# RAW-NEXT: SecByteLength: 4294967295
# RAW-NEXT: }
# RAW-NEXT: ]
-# RAW-NEXT: Globals Stream not present
-# RAW-NEXT: Publics Stream not present
# RAW-NEXT: Section Headers [
# RAW-NEXT: {
# RAW-NEXT: Name: .pdata
@@ -555,7 +393,7 @@
# RAW-NEXT: }
# RAW-NEXT: {
# RAW-NEXT: Name: .rdata
-# RAW-NEXT: Virtual Size: 101
+# RAW-NEXT: Virtual Size:
# RAW-NEXT: Virtual Address: 16384
# RAW-NEXT: Size of Raw Data: 512
# RAW-NEXT: File Pointer to Raw Data: 2560
@@ -569,5 +407,3 @@
# RAW-NEXT: ]
# RAW-NEXT: }
# RAW-NEXT: ]
-# RAW-NEXT: New FPO [
-# RAW-NEXT: ]
diff --git a/test/COFF/rsds.test b/test/COFF/rsds.test
index 37ec48b5068e1..82b0f220b6c13 100644
--- a/test/COFF/rsds.test
+++ b/test/COFF/rsds.test
@@ -4,7 +4,7 @@
# RUN: llvm-readobj -coff-debug-directory %t.dll | FileCheck %s
# RUN: lld-link /debug /pdb:%t.pdb /dll /out:%t.dll /entry:DllMain %t.obj
-# RUN: llvm-readobj -coff-debug-directory %t.dll | FileCheck %s -check-prefix CHECK-PDB
+# RUN: llvm-readobj -coff-debug-directory %t.dll | FileCheck %s
# CHECK: DebugDirectory [
# CHECK: DebugEntry {
@@ -13,37 +13,18 @@
# CHECK: MajorVersion: 0x0
# CHECK: MinorVersion: 0x0
# CHECK: Type: CodeView (0x2)
-# CHECK: SizeOfData: 0x19
+# CHECK: SizeOfData:
# CHECK: AddressOfRawData:
# CHECK: PointerToRawData:
# CHECK: PDBInfo {
# CHECK: PDBSignature: 0x53445352
# CHECK: PDBGUID:
# CHECK: PDBAge: 1
-# CHECK: PDBFileName: {{$}}
+# CHECK: PDBFileName: {{.*}}.pdb
# CHECK: }
# CHECK: }
# CHECK: ]
-# CHECK-PDB: DebugDirectory [
-# CHECK-PDB: DebugEntry {
-# CHECK-PDB: Characteristics: 0x0
-# CHECK-PDB: TimeDateStamp: 1970-01-01 00:00:00 (0x0)
-# CHECK-PDB: MajorVersion: 0x0
-# CHECK-PDB: MinorVersion: 0x0
-# CHECK-PDB: Type: CodeView (0x2)
-# CHECK-PDB: SizeOfData:
-# CHECK-PDB: AddressOfRawData:
-# CHECK-PDB: PointerToRawData:
-# CHECK-PDB: PDBInfo {
-# CHECK-PDB: PDBSignature: 0x53445352
-# CHECK-PDB: PDBGUID:
-# CHECK-PDB: PDBAge: 1
-# CHECK-PDB: PDBFileName: {{.*}}.pdb
-# CHECK-PDB: }
-# CHECK-PDB: }
-# CHECK-PDB: ]
-
--- !COFF
header:
Machine: IMAGE_FILE_MACHINE_I386
diff --git a/test/COFF/savetemps.ll b/test/COFF/savetemps.ll
new file mode 100644
index 0000000000000..4e59812441a90
--- /dev/null
+++ b/test/COFF/savetemps.ll
@@ -0,0 +1,28 @@
+; RUN: rm -fr %T/savetemps
+; RUN: mkdir %T/savetemps
+; RUN: llvm-as -o %T/savetemps/savetemps.obj %s
+; RUN: lld-link /out:%T/savetemps/savetemps.exe /entry:main \
+; RUN: /subsystem:console %T/savetemps/savetemps.obj
+; RUN: not llvm-dis -o - %T/savetemps/savetemps.exe.0.0.preopt.bc
+; RUN: not llvm-dis -o - %T/savetemps/savetemps.exe.0.2.internalize.bc
+; RUN: not llvm-dis -o - %T/savetemps/savetemps.exe.0.4.opt.bc
+; RUN: not llvm-dis -o - %T/savetemps/savetemps.exe.0.5.precodegen.bc
+; RUN: not llvm-objdump -s %T/savetemps/savetemps.exe.lto.obj
+; RUN: lld-link /lldsavetemps /out:%T/savetemps/savetemps.exe /entry:main \
+; RUN: /subsystem:console %T/savetemps/savetemps.obj
+; RUN: llvm-dis -o - %T/savetemps/savetemps.exe.0.0.preopt.bc | FileCheck %s
+; RUN: llvm-dis -o - %T/savetemps/savetemps.exe.0.2.internalize.bc | FileCheck %s
+; RUN: llvm-dis -o - %T/savetemps/savetemps.exe.0.4.opt.bc | FileCheck %s
+; RUN: llvm-dis -o - %T/savetemps/savetemps.exe.0.5.precodegen.bc | FileCheck %s
+; RUN: llvm-objdump -s %T/savetemps/savetemps.exe.lto.obj | \
+; RUN: FileCheck --check-prefix=CHECK-OBJDUMP %s
+
+; CHECK: define i32 @main()
+; CHECK-OBJDUMP: file format COFF
+
+target datalayout = "e-m:w-i64:64-f80:128-n8:16:32:64-S128"
+target triple = "x86_64-pc-windows-msvc"
+
+define i32 @main() {
+ ret i32 0
+}
diff --git a/test/COFF/thinlto-archives.ll b/test/COFF/thinlto-archives.ll
new file mode 100644
index 0000000000000..7a5e36aa1fb95
--- /dev/null
+++ b/test/COFF/thinlto-archives.ll
@@ -0,0 +1,22 @@
+; RUN: rm -fr %T/thinlto-archives
+; RUN: mkdir %T/thinlto-archives %T/thinlto-archives/a %T/thinlto-archives/b
+; RUN: opt -thinlto-bc -o %T/thinlto-archives/main.obj %s
+; RUN: opt -thinlto-bc -o %T/thinlto-archives/a/bar.obj %S/Inputs/lto-dep.ll
+; RUN: opt -thinlto-bc -o %T/thinlto-archives/b/bar.obj %S/Inputs/bar.ll
+; RUN: llvm-ar crs %T/thinlto-archives/a.lib %T/thinlto-archives/a/bar.obj
+; RUN: llvm-ar crs %T/thinlto-archives/b.lib %T/thinlto-archives/b/bar.obj
+; RUN: lld-link /out:%T/thinlto-archives/main.exe -entry:main \
+; RUN: -subsystem:console %T/thinlto-archives/main.obj \
+; RUN: %T/thinlto-archives/a.lib %T/thinlto-archives/b.lib
+
+target datalayout = "e-m:w-i64:64-f80:128-n8:16:32:64-S128"
+target triple = "x86_64-pc-windows-msvc"
+
+declare void @bar()
+declare void @foo()
+
+define i32 @main() {
+ call void @foo()
+ call void @bar()
+ ret i32 0
+}
diff --git a/test/COFF/thinlto-mangled.ll b/test/COFF/thinlto-mangled.ll
new file mode 100644
index 0000000000000..efcd9c3d2d0a8
--- /dev/null
+++ b/test/COFF/thinlto-mangled.ll
@@ -0,0 +1,16 @@
+; RUN: opt -thinlto-bc %s -o %t.obj
+; RUN: opt -thinlto-bc %S/Inputs/thinlto-mangled-qux.ll -o %T/thinlto-mangled-qux.obj
+; RUN: lld-link -out:%t.exe -entry:main %t.obj %T/thinlto-mangled-qux.obj
+
+target datalayout = "e-m:w-i64:64-f80:128-n8:16:32:64-S128"
+target triple = "x86_64-pc-windows-msvc19.0.24215"
+
+%"class.bar" = type { i32 (...)**, i8*, i8*, i8*, i32 }
+
+define i32 @main() {
+ ret i32 0
+}
+
+define available_externally zeroext i1 @"\01?x@bar@@UEBA_NXZ"(%"class.bar"* %this) unnamed_addr align 2 {
+ ret i1 false
+}
diff --git a/test/COFF/thinlto.ll b/test/COFF/thinlto.ll
new file mode 100644
index 0000000000000..11b689d6327ef
--- /dev/null
+++ b/test/COFF/thinlto.ll
@@ -0,0 +1,18 @@
+; RUN: rm -fr %T/thinlto
+; RUN: mkdir %T/thinlto
+; RUN: opt -thinlto-bc -o %T/thinlto/main.obj %s
+; RUN: opt -thinlto-bc -o %T/thinlto/foo.obj %S/Inputs/lto-dep.ll
+; RUN: lld-link /lldsavetemps /out:%T/thinlto/main.exe /entry:main /subsystem:console %T/thinlto/main.obj %T/thinlto/foo.obj
+; RUN: llvm-nm %T/thinlto/main.exe.lto.obj | FileCheck %s
+
+; CHECK-NOT: U foo
+
+target datalayout = "e-m:w-i64:64-f80:128-n8:16:32:64-S128"
+target triple = "x86_64-pc-windows-msvc"
+
+define i32 @main() {
+ call void @foo()
+ ret i32 0
+}
+
+declare void @foo()
diff --git a/test/COFF/weak-external.test b/test/COFF/weak-external.test
index e422b2e627618..7bdadd9b1c947 100644
--- a/test/COFF/weak-external.test
+++ b/test/COFF/weak-external.test
@@ -4,9 +4,8 @@
# RUN: lld-link /out:%t2.exe /entry:g /subsystem:console /lldmap:%t2.map %t.obj %t.lto.obj
# RUN: FileCheck %s < %t2.map
-# CHECK: <lto object>:
-# CHECK-NOT: :
-# CHECK: {{ g$}}
+# CHECK: lto.tmp
+# CHECK-NEXT: 0 g
--- !COFF
header:
diff --git a/test/COFF/weak-external3.test b/test/COFF/weak-external3.test
index 05ff859993a3c..a06ce48a61a67 100644
--- a/test/COFF/weak-external3.test
+++ b/test/COFF/weak-external3.test
@@ -5,13 +5,11 @@
# RUN: lld-link /out:%t2.exe /entry:f /subsystem:console /lldmap:%t2.map %t.obj %t.lto.obj
# RUN: FileCheck --check-prefix=CHECK2 %s < %t2.map
-# CHECK1: <lto object>:
-# CHECK1-NOT: :
-# CHECK1: {{ g$}}
+# CHECK1: lto.tmp
+# CHECK1-NEXT: 0 g
-# CHECK2: weak-external3{{.*}}:
-# CHECK2-NOT: :
-# CHECK2: {{ f$}}
+# CHECK2: weak-external3.test.tmp.obj
+# CHECK2-NEXT: 0 f
--- !COFF
header: