forked from OSchip/llvm-project
[Driver][test] Refactor LLVMgold tests
LLVMgold.so tests are duplicated in several places. Deduplicate them. Move the tests to lto.c and lto.cu Specify -fuse-ld=bfd or -fuse-ld=gold. In a future change, if -fuse-ld=lld or CLANG_DEFAULT_LINKER=lld without -fuse-ld=, we will remove -plugin /path/to/LLVMgold.so
This commit is contained in:
parent
8d4fe864c4
commit
70e0935256
|
@ -161,10 +161,6 @@
|
|||
// CHECK-ARM-EABIHF-NOT: as{{.*}}" "-mfpu=softvfp"
|
||||
// CHECK-ARM-EABIHF-NOT: as{{.*}}" "-matpcs"
|
||||
|
||||
// RUN: %clang -target x86_64-pc-freebsd8 %s -### -flto 2>&1 \
|
||||
// RUN: | FileCheck --check-prefix=CHECK-LTO %s
|
||||
// CHECK-LTO: ld{{.*}}" "-plugin{{.*}}{{[/\\]}}LLVMgold.{{dll|dylib|so}}
|
||||
|
||||
// RUN: %clang -target sparc-unknown-freebsd8 %s -### -fpic -no-integrated-as 2>&1 \
|
||||
// RUN: | FileCheck --check-prefix=CHECK-SPARC-PIE %s
|
||||
// CHECK-SPARC-PIE: as{{.*}}" "-KPIC
|
||||
|
|
|
@ -1,28 +0,0 @@
|
|||
// RUN: touch %t.o
|
||||
//
|
||||
// RUN: %clang -target x86_64-unknown-linux -### %t.o -flto 2>&1 \
|
||||
// RUN: -Wl,-plugin-opt=foo -O3 \
|
||||
// RUN: | FileCheck %s --check-prefix=CHECK-X86-64-BASIC
|
||||
// CHECK-X86-64-BASIC: "-plugin" "{{.*}}{{[/\\]}}LLVMgold.{{dll|dylib|so}}"
|
||||
// CHECK-X86-64-BASIC: "-plugin-opt=O3"
|
||||
// CHECK-X86-64-BASIC: "-plugin-opt=foo"
|
||||
//
|
||||
// RUN: %clang -target x86_64-unknown-linux -### %t.o -flto 2>&1 \
|
||||
// RUN: -march=corei7 -Wl,-plugin-opt=foo -Ofast \
|
||||
// RUN: | FileCheck %s --check-prefix=CHECK-X86-64-COREI7
|
||||
// CHECK-X86-64-COREI7: "-plugin" "{{.*}}{{[/\\]}}LLVMgold.{{dll|dylib|so}}"
|
||||
// CHECK-X86-64-COREI7: "-plugin-opt=mcpu=corei7"
|
||||
// CHECK-X86-64-COREI7: "-plugin-opt=O3"
|
||||
// CHECK-X86-64-COREI7: "-plugin-opt=foo"
|
||||
//
|
||||
// RUN: %clang -target arm-unknown-linux -### %t.o -flto 2>&1 \
|
||||
// RUN: -march=armv7a -Wl,-plugin-opt=foo -O0 \
|
||||
// RUN: | FileCheck %s --check-prefix=CHECK-ARM-V7A
|
||||
// CHECK-ARM-V7A: "-plugin" "{{.*}}{{[/\\]}}LLVMgold.{{dll|dylib|so}}"
|
||||
// CHECK-ARM-V7A: "-plugin-opt=mcpu=generic"
|
||||
// CHECK-ARM-V7A: "-plugin-opt=O0"
|
||||
// CHECK-ARM-V7A: "-plugin-opt=foo"
|
||||
//
|
||||
// RUN: %clang -target i686-linux-android -### %t.o -flto 2>&1 \
|
||||
// RUN: | FileCheck %s --check-prefix=CHECK-X86-ANDROID
|
||||
// CHECK-X86-ANDROID: "-plugin" "{{.*}}{{[/\\]}}LLVMgold.{{dll|dylib|so}}"
|
|
@ -1,6 +0,0 @@
|
|||
// Check that Darwin uses LLVMgold.dylib.
|
||||
// REQUIRES: system-darwin
|
||||
// RUN: %clang -### %s -target x86_64-unknown-linux -flto 2>&1 \
|
||||
// RUN: | FileCheck -check-prefix=CHECK-LTO-PLUGIN %s
|
||||
//
|
||||
// CHECK-LTO-PLUGIN: "-plugin" "{{.*}}/LLVMgold.dylib"
|
|
@ -1,6 +0,0 @@
|
|||
// Check that non-Windows, non-Darwin OSs use LLVMgold.so.
|
||||
// REQUIRES: !system-darwin && !system-windows
|
||||
// RUN: %clang -### %s -target x86_64-unknown-linux -flto 2>&1 \
|
||||
// RUN: | FileCheck -check-prefix=CHECK-LTO-PLUGIN %s
|
||||
//
|
||||
// CHECK-LTO-PLUGIN: "-plugin" "{{.*}}/LLVMgold.so"
|
|
@ -1,6 +0,0 @@
|
|||
// Check that Windows uses LLVMgold.dll.
|
||||
// REQUIRES: system-windows
|
||||
// RUN: %clang -### %s -target x86_64-unknown-linux -flto 2>&1 \
|
||||
// RUN: | FileCheck -check-prefix=CHECK-LTO-PLUGIN %s
|
||||
//
|
||||
// CHECK-LTO-PLUGIN: "-plugin" "{{.*}}\\LLVMgold.dll"
|
|
@ -32,23 +32,18 @@
|
|||
// RUN: not %clang %s -emit-llvm 2>&1 | FileCheck --check-prefix=LLVM-LINK %s
|
||||
// LLVM-LINK: -emit-llvm cannot be used when linking
|
||||
|
||||
// -flto should cause link using gold plugin
|
||||
// RUN: %clang -target x86_64-unknown-linux -### %s -flto 2> %t
|
||||
// RUN: FileCheck -check-prefix=CHECK-LINK-LTO-ACTION < %t %s
|
||||
//
|
||||
// CHECK-LINK-LTO-ACTION: "-plugin" "{{.*}}{{[/\\]}}LLVMgold.{{dll|dylib|so}}"
|
||||
/// With ld.bfd or gold, link against LLVMgold.
|
||||
// RUN: %clang -target x86_64-unknown-linux-gnu --sysroot %S/Inputs/basic_cross_linux_tree %s \
|
||||
// RUN: -fuse-ld=bfd -flto=thin -### 2>&1 | FileCheck --check-prefix=LLVMGOLD %s
|
||||
// RUN: %clang -target x86_64-unknown-linux-gnu --sysroot %S/Inputs/basic_cross_linux_tree %s \
|
||||
// RUN: -fuse-ld=gold -flto=full -### 2>&1 | FileCheck --check-prefix=LLVMGOLD %s
|
||||
// RUN: %clang -target x86_64-unknown-linux-gnu --sysroot %S/Inputs/basic_cross_linux_tree %s \
|
||||
// RUN: -fuse-ld=gold -fno-lto -flto -### 2>&1 | FileCheck --check-prefix=LLVMGOLD %s
|
||||
// LLVMGOLD: "-plugin" "{{.*}}{{[/\\]}}LLVMgold.{{dll|dylib|so}}"
|
||||
|
||||
// -flto=full should cause link using gold plugin
|
||||
// RUN: %clang -target x86_64-unknown-linux -### %s -flto=full 2> %t
|
||||
// RUN: FileCheck -check-prefix=CHECK-LINK-FULL-ACTION < %t %s
|
||||
//
|
||||
// CHECK-LINK-FULL-ACTION: "-plugin" "{{.*}}{{[/\\]}}LLVMgold.{{dll|dylib|so}}"
|
||||
|
||||
// Check that subsequent -fno-lto takes precedence
|
||||
// RUN: %clang -target x86_64-unknown-linux -### %s -flto=full -fno-lto 2> %t
|
||||
// RUN: FileCheck -check-prefix=CHECK-LINK-NOLTO-ACTION < %t %s
|
||||
//
|
||||
// CHECK-LINK-NOLTO-ACTION-NOT: "-plugin" "{{.*}}{{[/\\]}}LLVMgold.{{dll|dylib|so}}"
|
||||
// RUN: %clang -target x86_64-unknown-linux-gnu --sysroot %S/Inputs/basic_cross_linux_tree %s \
|
||||
// RUN: -fuse-ld=gold -flto -fno-lto -### 2>&1 | FileCheck --check-prefix=NO-LLVMGOLD %s
|
||||
// NO-LLVMGOLD-NOT: "-plugin" "{{.*}}{{[/\\]}}LLVMgold.{{dll|dylib|so}}"
|
||||
|
||||
// -flto passes along an explicit debugger tuning argument.
|
||||
// RUN: %clang -target x86_64-unknown-linux -### %s -flto -glldb 2> %t
|
||||
|
|
|
@ -47,26 +47,19 @@
|
|||
// RUN: | FileCheck --check-prefix=LLVM-LINK %s
|
||||
// LLVM-LINK: -emit-llvm cannot be used when linking
|
||||
|
||||
// -flto should cause link using gold plugin
|
||||
// RUN: %clangxx -nocudainc -nocudalib \
|
||||
// RUN: -target x86_64-unknown-linux -### %s -flto 2> %t
|
||||
// RUN: FileCheck -check-prefix=CHECK-LINK-LTO-ACTION < %t %s
|
||||
/// With ld.bfd or gold, link against LLVMgold.
|
||||
// RUN: %clangxx -nocudainc -nocudalib -target x86_64-unknown-linux-gnu --sysroot %S/Inputs/basic_cross_linux_tree %s \
|
||||
// RUN: -fuse-ld=bfd -flto=thin -### 2>&1 | FileCheck --check-prefix=LLVMGOLD %s
|
||||
// RUN: %clangxx -nocudainc -nocudalib -target x86_64-unknown-linux-gnu --sysroot %S/Inputs/basic_cross_linux_tree %s \
|
||||
// RUN: -fuse-ld=gold -flto=full -### 2>&1 | FileCheck --check-prefix=LLVMGOLD %s
|
||||
//
|
||||
// CHECK-LINK-LTO-ACTION: "-plugin" "{{.*}}{{[/\\]}}LLVMgold.{{dll|dylib|so}}"
|
||||
|
||||
// -flto=full should cause link using gold plugin
|
||||
// RUN: %clangxx -nocudainc -nocudalib \
|
||||
// RUN: -target x86_64-unknown-linux -### %s -flto=full 2> %t
|
||||
// RUN: FileCheck -check-prefix=CHECK-LINK-FULL-ACTION < %t %s
|
||||
//
|
||||
// CHECK-LINK-FULL-ACTION: "-plugin" "{{.*}}{{[/\\]}}LLVMgold.{{dll|dylib|so}}"
|
||||
// LLVMGOLD: "-plugin" "{{.*}}{{[/\\]}}LLVMgold.{{dll|dylib|so}}"
|
||||
|
||||
// Check that subsequent -fno-lto takes precedence
|
||||
// RUN: %clangxx -nocudainc -nocudalib \
|
||||
// RUN: -target x86_64-unknown-linux -### %s -flto=full -fno-lto 2> %t
|
||||
// RUN: FileCheck -check-prefix=CHECK-LINK-NOLTO-ACTION < %t %s
|
||||
// RUN: %clangxx -nocudainc -nocudalib -target x86_64-unknown-linux-gnu --sysroot %S/Inputs/basic_cross_linux_tree %s \
|
||||
// RUN: -fuse-ld=gold -flto=full -fno-lto -### 2>&1 | FileCheck --check-prefix=NO-LLVMGOLD %s
|
||||
//
|
||||
// CHECK-LINK-NOLTO-ACTION-NOT: "-plugin" "{{.*}}{{[/\\]}}LLVMgold.{{dll|dylib|so}}"
|
||||
// NO-LLVMGOLD-NOT: "-plugin" "{{.*}}{{[/\\]}}LLVMgold.{{dll|dylib|so}}"
|
||||
|
||||
// -flto passes along an explicit debugger tuning argument.
|
||||
// RUN: %clangxx -nocudainc -nocudalib \
|
||||
|
|
|
@ -13,25 +13,3 @@
|
|||
// CHECK-COMPILELINK-ACTIONS: 2: compiler, {1}, ir
|
||||
// CHECK-COMPILELINK-ACTIONS: 3: backend, {2}, lto-bc
|
||||
// CHECK-COMPILELINK-ACTIONS: 4: linker, {3}, image
|
||||
|
||||
// -flto=thin should cause link using gold plugin with thinlto option,
|
||||
// also confirm that it takes precedence over earlier -fno-lto and -flto=full.
|
||||
// RUN: %clang -target x86_64-unknown-linux -### %s -flto=full -fno-lto -flto=thin 2> %t
|
||||
// RUN: FileCheck -check-prefix=CHECK-LINK-THIN-ACTION < %t %s
|
||||
//
|
||||
// CHECK-LINK-THIN-ACTION: "-plugin" "{{.*}}{{[/\\]}}LLVMgold.{{dll|dylib|so}}"
|
||||
// CHECK-LINK-THIN-ACTION: "-plugin-opt=thinlto"
|
||||
|
||||
// Check that subsequent -flto=full takes precedence
|
||||
// RUN: %clang -target x86_64-unknown-linux -### %s -flto=thin -flto=full 2> %t
|
||||
// RUN: FileCheck -check-prefix=CHECK-LINK-FULL-ACTION < %t %s
|
||||
//
|
||||
// CHECK-LINK-FULL-ACTION: "-plugin" "{{.*}}{{[/\\]}}LLVMgold.{{dll|dylib|so}}"
|
||||
// CHECK-LINK-FULL-ACTION-NOT: "-plugin-opt=thinlto"
|
||||
|
||||
// Check that subsequent -fno-lto takes precedence
|
||||
// RUN: %clang -target x86_64-unknown-linux -### %s -flto=thin -fno-lto 2> %t
|
||||
// RUN: FileCheck -check-prefix=CHECK-LINK-NOLTO-ACTION < %t %s
|
||||
//
|
||||
// CHECK-LINK-NOLTO-ACTION-NOT: "-plugin" "{{.*}}{{[/\\]}}LLVMgold.{{dll|dylib|so}}"
|
||||
// CHECK-LINK-NOLTO-ACTION-NOT: "-plugin-opt=thinlto"
|
||||
|
|
|
@ -27,28 +27,3 @@
|
|||
// CHECK-COMPILELINK-ACTIONS: 11: offload, "host-cuda {{.*}}" {2}, "device-cuda{{.*}}" {10}, ir
|
||||
// CHECK-COMPILELINK-ACTIONS: 12: backend, {11}, lto-bc, (host-cuda)
|
||||
// CHECK-COMPILELINK-ACTIONS: 13: linker, {12}, image, (host-cuda)
|
||||
|
||||
// -flto=thin should cause link using gold plugin with thinlto option,
|
||||
// also confirm that it takes precedence over earlier -fno-lto and -flto=full.
|
||||
// RUN: %clangxx -nocudainc -nocudalib \
|
||||
// RUN: -target x86_64-unknown-linux -### %s -flto=full -fno-lto -flto=thin 2> %t
|
||||
// RUN: FileCheck -check-prefix=CHECK-LINK-THIN-ACTION < %t %s
|
||||
//
|
||||
// CHECK-LINK-THIN-ACTION: "-plugin" "{{.*}}{{[/\\]}}LLVMgold.{{dll|dylib|so}}"
|
||||
// CHECK-LINK-THIN-ACTION: "-plugin-opt=thinlto"
|
||||
|
||||
// Check that subsequent -flto=full takes precedence
|
||||
// RUN: %clangxx -nocudainc -nocudalib \
|
||||
// RUN: -target x86_64-unknown-linux -### %s -flto=thin -flto=full 2> %t
|
||||
// RUN: FileCheck -check-prefix=CHECK-LINK-FULL-ACTION < %t %s
|
||||
//
|
||||
// CHECK-LINK-FULL-ACTION: "-plugin" "{{.*}}{{[/\\]}}LLVMgold.{{dll|dylib|so}}"
|
||||
// CHECK-LINK-FULL-ACTION-NOT: "-plugin-opt=thinlto"
|
||||
|
||||
// Check that subsequent -fno-lto takes precedence
|
||||
// RUN: %clangxx -nocudainc -nocudalib \
|
||||
// RUN: -target x86_64-unknown-linux -### %s -flto=thin -fno-lto 2> %t
|
||||
// RUN: FileCheck -check-prefix=CHECK-LINK-NOLTO-ACTION < %t %s
|
||||
//
|
||||
// CHECK-LINK-NOLTO-ACTION-NOT: "-plugin" "{{.*}}{{[/\\]}}LLVMgold.{{dll|dylib|so}}"
|
||||
// CHECK-LINK-NOLTO-ACTION-NOT: "-plugin-opt=thinlto"
|
||||
|
|
Loading…
Reference in New Issue