Support -fuse-ld=lld for riscv

Add a configure feature test to filter out tests that explicitly depend on platform linker.

Differential Revision: https://reviews.llvm.org/D74704
This commit is contained in:
serge-sans-paille 2020-02-17 13:42:00 +01:00
parent d4eca120ac
commit e058667a2e
4 changed files with 14 additions and 1 deletions

View File

@ -142,7 +142,7 @@ void RISCV::Linker::ConstructJob(Compilation &C, const JobAction &JA,
CmdArgs.push_back("elf32lriscv");
}
std::string Linker = getToolChain().GetProgramPath(getShortName());
std::string Linker = getToolChain().GetLinkerPath();
bool WantCRTs =
!Args.hasArg(options::OPT_nostdlib, options::OPT_nostartfiles);

View File

@ -1,8 +1,13 @@
// A basic clang -cc1 command-line, and simple environment check.
// REQUIRES: platform-linker
// RUN: %clang %s -### -no-canonical-prefixes -target riscv32 2>&1 | FileCheck -check-prefix=CC1 %s
// CC1: clang{{.*}} "-cc1" "-triple" "riscv32"
// Test interaction with -fuse-ld=lld, if lld is available.
// RUN: %clang %s -### -no-canonical-prefixes -target riscv32 -fuse-ld=lld 2>&1 | FileCheck -check-prefix=LLD %s
// LLD: {{(error: invalid linker name in argument '-fuse-ld=lld')|(ld.lld)}}
// In the below tests, --rtlib=platform is used so that the driver ignores
// the configure-time CLANG_DEFAULT_RTLIB option when choosing the runtime lib

View File

@ -1,8 +1,13 @@
// A basic clang -cc1 command-line, and simple environment check.
// REQUIRES: platform-linker
// RUN: %clang %s -### -no-canonical-prefixes -target riscv64 2>&1 | FileCheck -check-prefix=CC1 %s
// CC1: clang{{.*}} "-cc1" "-triple" "riscv64"
// Test interaction with -fuse-ld=lld, if lld is available.
// RUN: %clang %s -### -no-canonical-prefixes -target riscv32 -fuse-ld=lld 2>&1 | FileCheck -check-prefix=LLD %s
// LLD: {{(error: invalid linker name in argument '-fuse-ld=lld')|(ld.lld)}}
// In the below tests, --rtlib=platform is used so that the driver ignores
// the configure-time CLANG_DEFAULT_RTLIB option when choosing the runtime lib

View File

@ -46,5 +46,8 @@ except KeyError:
import lit.llvm
lit.llvm.initialize(lit_config, config)
if not "@CLANG_DEFAULT_LINKER@":
config.available_features('platform-linker')
# Let the main config do the real work.
lit_config.load_config(config, "@CLANG_SOURCE_DIR@/test/lit.cfg.py")