[PATCH] D74704: Support -fuse-ld=lld for riscv
serge via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Fri Feb 21 01:44:30 PST 2020
serge-sans-paille updated this revision to Diff 245805.
serge-sans-paille added a comment.
Add a configure feature test to filter out tests that depend on platform linker, as hinted by @MaskRay
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D74704/new/
https://reviews.llvm.org/D74704
Files:
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
Index: clang/test/lit.site.cfg.py.in
===================================================================
--- clang/test/lit.site.cfg.py.in
+++ clang/test/lit.site.cfg.py.in
@@ -46,5 +46,8 @@
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")
Index: clang/test/Driver/riscv64-toolchain.c
===================================================================
--- clang/test/Driver/riscv64-toolchain.c
+++ 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
Index: clang/test/Driver/riscv32-toolchain.c
===================================================================
--- clang/test/Driver/riscv32-toolchain.c
+++ 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
Index: clang/lib/Driver/ToolChains/RISCVToolchain.cpp
===================================================================
--- clang/lib/Driver/ToolChains/RISCVToolchain.cpp
+++ clang/lib/Driver/ToolChains/RISCVToolchain.cpp
@@ -142,7 +142,7 @@
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);
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D74704.245805.patch
Type: text/x-patch
Size: 2711 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20200221/9e9063f0/attachment.bin>
More information about the cfe-commits
mailing list