1; REQUIRES: x86
2; RUN: rm -fr %T/thinlto
3; RUN: mkdir %T/thinlto
4; RUN: opt -thinlto-bc -o %T/thinlto/main.obj %s
5; RUN: opt -thinlto-bc -o %T/thinlto/foo.obj %S/Inputs/lto-dep.ll
6; RUN: lld-link /lldsavetemps /out:%T/thinlto/main.exe /entry:main /subsystem:console %T/thinlto/main.obj %T/thinlto/foo.obj
7; RUN: llvm-nm %T/thinlto/main.exe.lto.1.obj | FileCheck %s
8
9; Test various possible options for /opt:lldltojobs
10; RUN: lld-link /lldsavetemps /out:%T/thinlto/main.exe /entry:main /subsystem:console %T/thinlto/main.obj %T/thinlto/foo.obj /opt:lldltojobs=1
11; RUN: llvm-nm %T/thinlto/main.exe.lto.1.obj | FileCheck %s
12; RUN: lld-link /lldsavetemps /out:%T/thinlto/main.exe /entry:main /subsystem:console %T/thinlto/main.obj %T/thinlto/foo.obj /opt:lldltojobs=all
13; RUN: llvm-nm %T/thinlto/main.exe.lto.1.obj | FileCheck %s
14; RUN: lld-link /lldsavetemps /out:%T/thinlto/main.exe /entry:main /subsystem:console %T/thinlto/main.obj %T/thinlto/foo.obj /opt:lldltojobs=100
15; RUN: llvm-nm %T/thinlto/main.exe.lto.1.obj | FileCheck %s
16; RUN: not lld-link /lldsavetemps /out:%T/thinlto/main.exe /entry:main /subsystem:console %T/thinlto/main.obj %T/thinlto/foo.obj /opt:lldltojobs=foo 2>&1 | FileCheck %s --check-prefix=BAD-JOBS
17; BAD-JOBS: error: /opt:lldltojobs: invalid job count: foo
18
19; This command will store full path to foo.obj in the archive %t.lib
20; Check that /lldsavetemps is still usable in such case.
21; RUN: lld-link /lib %T/thinlto/foo.obj /out:%t.lib
22; RUN: lld-link /lldsavetemps /out:%t.exe /entry:main /subsystem:console %T/thinlto/main.obj %t.lib
23
24; CHECK-NOT: U foo
25
26target datalayout = "e-m:w-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
27target triple = "x86_64-pc-windows-msvc"
28
29define i32 @main() {
30  call void @foo()
31  ret i32 0
32}
33
34declare void @foo()
35