[clang] e058667 - Support -fuse-ld=lld for riscv
via cfe-commits
cfe-commits at lists.llvm.org
Wed Feb 26 01:20:42 PST 2020
Author: serge-sans-paille
Date: 2020-02-26T10:20:20+01:00
New Revision: e058667a2e017d3225a9bb067dbac7f2159576f7
URL: https://github.com/llvm/llvm-project/commit/e058667a2e017d3225a9bb067dbac7f2159576f7
DIFF: https://github.com/llvm/llvm-project/commit/e058667a2e017d3225a9bb067dbac7f2159576f7.diff
LOG: 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
Added:
Modified:
clang/lib/Driver/ToolChains/RISCVToolchain.cpp
clang/test/Driver/riscv32-toolchain.c
clang/test/Driver/riscv64-toolchain.c
clang/test/lit.site.cfg.py.in
Removed:
################################################################################
diff --git a/clang/lib/Driver/ToolChains/RISCVToolchain.cpp b/clang/lib/Driver/ToolChains/RISCVToolchain.cpp
index 24c2b37c4b77..21106d003859 100644
--- a/clang/lib/Driver/ToolChains/RISCVToolchain.cpp
+++ b/clang/lib/Driver/ToolChains/RISCVToolchain.cpp
@@ -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);
diff --git a/clang/test/Driver/riscv32-toolchain.c b/clang/test/Driver/riscv32-toolchain.c
index 2ff3a585bda3..b83c9aafcbfc 100644
--- a/clang/test/Driver/riscv32-toolchain.c
+++ b/clang/test/Driver/riscv32-toolchain.c
@@ -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
diff --git a/clang/test/Driver/riscv64-toolchain.c b/clang/test/Driver/riscv64-toolchain.c
index 42cac51de59e..a5cfc1242db7 100644
--- a/clang/test/Driver/riscv64-toolchain.c
+++ b/clang/test/Driver/riscv64-toolchain.c
@@ -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
diff --git a/clang/test/lit.site.cfg.py.in b/clang/test/lit.site.cfg.py.in
index e9b35ac01771..1f37ad935bd4 100644
--- a/clang/test/lit.site.cfg.py.in
+++ b/clang/test/lit.site.cfg.py.in
@@ -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")
More information about the cfe-commits
mailing list