| 1 |
// RUN: %clang --target=x86_64-unknown-linux-gnu -flto -ffat-lto-objects -### %s -c 2>&1 | FileCheck %s -check-prefix=CHECK-CC |
| 2 |
// RUN: %clang --target=i386-pc-win32 -flto -ffat-lto-objects -### %s -c 2>&1 | FileCheck %s -check-prefix=CHECK-CC |
| 3 |
// CHECK-CC: -cc1 |
| 4 |
// CHECK-CC-SAME: -emit-obj |
| 5 |
// CHECK-CC-SAME: -ffat-lto-objects |
| 6 |
|
| 7 |
/// 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. |
| 8 |
// RUN: %clang --target=x86_64-unknown-linux-gnu -ffat-lto-objects -### %s -S 2>&1 | FileCheck %s -check-prefix=CHECK-CC-S |
| 9 |
// RUN: %clang --target=i386-pc-win32 -ffat-lto-objects -### %s -S 2>&1 | FileCheck %s -check-prefix=CHECK-CC-S |
| 10 |
// CHECK-CC-S: -cc1 |
| 11 |
// CHECK-CC-S: -S |
| 12 |
// CHECK-CC-S-NOT: -emit-obj |
| 13 |
// CHECK-CC-S-NOT: -emit-llvm |
| 14 |
// CHECK-CC-S-NOT: -ffat-lto-objects |
| 15 |
|
| 16 |
/// When fat LTO is enabled with -S, we expect asm output and -ffat-lto-objects to be passed to cc1. |
| 17 |
// RUN: %clang --target=x86_64-unknown-linux-gnu -flto -ffat-lto-objects -### %s -S 2>&1 | FileCheck %s -check-prefix=CHECK-CC-S-LTO |
| 18 |
// RUN: %clang --target=i386-pc-win32 -flto -ffat-lto-objects -### %s -S 2>&1 | FileCheck %s -check-prefix=CHECK-CC-S-LTO |
| 19 |
// CHECK-CC-S-LTO: -cc1 |
| 20 |
// CHECK-CC-S-NOT: -emit-llvm |
| 21 |
// CHECK-CC-S-LTO-SAME: -ffat-lto-objects |
| 22 |
|
| 23 |
/// When fat LTO is enabled with -S and -emit-llvm, we expect IR output and -ffat-lto-objects to be passed to cc1. |
| 24 |
// 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 |
| 25 |
// RUN: %clang --target=i386-pc-win32 -flto -ffat-lto-objects -### %s -S -emit-llvm 2>&1 | FileCheck %s -check-prefix=CHECK-CC-S-EL-LTO |
| 26 |
// CHECK-CC-S-EL-LTO: -cc1 |
| 27 |
// CHECK-CC-S-EL-LTO-SAME: -emit-llvm |
| 28 |
// CHECK-CC-S-EL-LTO-SAME: -ffat-lto-objects |
| 29 |
|
| 30 |
/// When fat LTO is enabled without -S we expect native object output and -ffat-lto-object to be passed to cc1. |
| 31 |
// RUN: %clang --target=x86_64-unknown-linux-gnu -flto -ffat-lto-objects -### %s -c 2>&1 | FileCheck %s -check-prefix=CHECK-CC-C-LTO |
| 32 |
// RUN: %clang --target=i386-pc-win32 -flto -ffat-lto-objects -### %s -c 2>&1 | FileCheck %s -check-prefix=CHECK-CC-C-LTO |
| 33 |
// CHECK-CC-C-LTO: -cc1 |
| 34 |
// CHECK-CC-C-LTO-SAME: -emit-obj |
| 35 |
// CHECK-CC-C-LTO-SAME: -ffat-lto-objects |
| 36 |
|
| 37 |
/// When fat LTO is enabled with -c and -emit-llvm we expect bitcode output and -ffat-lto-object to be passed to cc1. |
| 38 |
// 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 |
| 39 |
// RUN: %clang --target=i386-pc-win32 -flto -ffat-lto-objects -### %s -c -emit-llvm 2>&1 | FileCheck %s -check-prefix=CHECK-CC-C-EL-LTO |
| 40 |
// CHECK-CC-C-EL-LTO: -cc1 |
| 41 |
// CHECK-CC-C-EL-LTO-SAME: -emit-llvm-bc |
| 42 |
// CHECK-CC-C-EL-LTO-SAME: -ffat-lto-objects |
| 43 |
|
| 44 |
/// Make sure we don't have a warning for -ffat-lto-objects being unused |
| 45 |
// 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 |
| 46 |
// RUN: %clang --target=i386-pc-win32 -ffat-lto-objects -fdriver-only -Werror -v %s -c 2>&1 | FileCheck %s -check-prefix=CHECK-CC-NOLTO |
| 47 |
// CHECK-CC-NOLTO: -cc1 |
| 48 |
// CHECK-CC-NOLTO-SAME: -emit-obj |
| 49 |
// CHECK-CC-NOLTO-NOT: -ffat-lto-objects |
| 50 |
|
| 51 |
// RUN: %clang --target=x86_64-unknown-linux-gnu -flto -ffat-lto-objects -fno-fat-lto-objects -### %s -c 2>&1 | FileCheck %s -check-prefix=CHECK-CC-NOLTO |
| 52 |
// RUN: %clang --target=i386-pc-win32 -flto -ffat-lto-objects -fno-fat-lto-objects -### %s -c 2>&1 | FileCheck %s -check-prefix=CHECK-CC-NOLTO |
| 53 |
|
| 54 |
/// We need to pass an additional flag (--fat-lto-objects) to lld when linking w/ -flto -ffat-lto-objects |
| 55 |
/// But it should not be there when LTO is disabled w/ -fno-lto |
| 56 |
// RUN: %clang --target=x86_64-unknown-linux-gnu --sysroot=%S/Inputs/basic_cross_linux_tree %s \ |
| 57 |
// RUN: -fuse-ld=lld -flto -ffat-lto-objects -### 2>&1 | FileCheck --check-prefix=LTO %s |
| 58 |
// RUN: %clang --target=x86_64-unknown-linux-gnu --sysroot=%S/Inputs/basic_cross_linux_tree %s \ |
| 59 |
// RUN: -fuse-ld=lld -fno-lto -ffat-lto-objects -### 2>&1 | FileCheck --check-prefix=NOLTO %s |
| 60 |
// RUN: %clang --target=x86_64-unknown-linux-gnu --sysroot=%S/Inputs/basic_cross_linux_tree %s \ |
| 61 |
// RUN: -fuse-ld=lld --ld-path=%S/Inputs/basic_cross_linux_tree/usr/x86_64-unknown-linux-gnu/bin/lld-wrapper \ |
| 62 |
// RUN: -flto -ffat-lto-objects -### 2>&1 | FileCheck --check-prefix=LTO %s |
| 63 |
// LTO: "--fat-lto-objects" |
| 64 |
// NOLTO-NOT: "--fat-lto-objects" |