1 // RUN: %clang --target=x86_64-unknown-linux-gnu -flto -ffat-lto-objects -### %s -c 2>&1 | FileCheck %s -check-prefix=CHECK-CC
3 // CHECK-CC-SAME: -emit-obj
4 // CHECK-CC-SAME: -ffat-lto-objects
6 /// Without -flto -S will just emit normal ASM, so we don't expect -emit-{llvm,obj} or -ffat-lto-objects to be passed to cc1.
7 // RUN: %clang --target=x86_64-unknown-linux-gnu -ffat-lto-objects -### %s -S 2>&1 | FileCheck %s -check-prefix=CHECK-CC-S
10 // CHECK-CC-S-NOT: -emit-obj
11 // CHECK-CC-S-NOT: -emit-llvm
12 // CHECK-CC-S-NOT: -ffat-lto-objects
14 /// When fat LTO is enabled with -S, we expect asm output and -ffat-lto-objects to be passed to cc1.
15 // RUN: %clang --target=x86_64-unknown-linux-gnu -flto -ffat-lto-objects -### %s -S 2>&1 | FileCheck %s -check-prefix=CHECK-CC-S-LTO
16 // CHECK-CC-S-LTO: -cc1
17 // CHECK-CC-S-NOT: -emit-llvm
18 // CHECK-CC-S-LTO-SAME: -ffat-lto-objects
20 /// When fat LTO is enabled with -S and -emit-llvm, we expect IR output and -ffat-lto-objects to be passed to cc1.
21 // RUN: %clang --target=x86_64-unknown-linux-gnu -flto -ffat-lto-objects -### %s -S -emit-llvm 2>&1 | FileCheck %s -check-prefix=CHECK-CC-S-EL-LTO
22 // CHECK-CC-S-EL-LTO: -cc1
23 // CHECK-CC-S-EL-LTO-SAME: -emit-llvm
24 // CHECK-CC-S-EL-LTO-SAME: -ffat-lto-objects
26 /// When fat LTO is enabled without -S we expect native object output and -ffat-lto-object to be passed to cc1.
27 // RUN: %clang --target=x86_64-unknown-linux-gnu -flto -ffat-lto-objects -### %s -c 2>&1 | FileCheck %s -check-prefix=CHECK-CC-C-LTO
28 // CHECK-CC-C-LTO: -cc1
29 // CHECK-CC-C-LTO-SAME: -emit-obj
30 // CHECK-CC-C-LTO-SAME: -ffat-lto-objects
32 /// When fat LTO is enabled with -c and -emit-llvm we expect bitcode output and -ffat-lto-object to be passed to cc1.
33 // RUN: %clang --target=x86_64-unknown-linux-gnu -flto -ffat-lto-objects -### %s -c -emit-llvm 2>&1 | FileCheck %s -check-prefix=CHECK-CC-C-EL-LTO
34 // CHECK-CC-C-EL-LTO: -cc1
35 // CHECK-CC-C-EL-LTO-SAME: -emit-llvm-bc
36 // CHECK-CC-C-EL-LTO-SAME: -ffat-lto-objects
38 /// Make sure we don't have a warning for -ffat-lto-objects being unused
39 // RUN: %clang --target=x86_64-unknown-linux-gnu -ffat-lto-objects -fdriver-only -Werror -v %s -c 2>&1 | FileCheck %s -check-prefix=CHECK-CC-NOLTO
40 // CHECK-CC-NOLTO: -cc1
41 // CHECK-CC-NOLTO-SAME: -emit-obj
42 // CHECK-CC-NOLTO-NOT: -ffat-lto-objects
44 /// We need to pass an additional flag (--fat-lto-objects) to lld when linking w/ -flto -ffat-lto-objects
45 /// But it should not be there when LTO is disabled w/ -fno-lto
46 // RUN: %clang --target=x86_64-unknown-linux-gnu --sysroot=%S/Inputs/basic_cross_linux_tree %s \
47 // RUN: -fuse-ld=lld -flto -ffat-lto-objects -### 2>&1 | FileCheck --check-prefix=LTO %s
48 // RUN: %clang --target=x86_64-unknown-linux-gnu --sysroot=%S/Inputs/basic_cross_linux_tree %s \
49 // RUN: -fuse-ld=lld -fno-lto -ffat-lto-objects -### 2>&1 | FileCheck --check-prefix=NOLTO %s
50 // LTO: "--fat-lto-objects"
51 // NOLTO-NOT: "--fat-lto-objects"