[clang] dd23014 - Support -fuse-ld=lld for riscv

via cfe-commits cfe-commits at lists.llvm.org
Tue Feb 18 02:24:23 PST 2020


Author: serge-sans-paille
Date: 2020-02-18T11:24:09+01:00
New Revision: dd230142d8a00f5f30c3930a2407000e845dcfbf

URL: https://github.com/llvm/llvm-project/commit/dd230142d8a00f5f30c3930a2407000e845dcfbf
DIFF: https://github.com/llvm/llvm-project/commit/dd230142d8a00f5f30c3930a2407000e845dcfbf.diff

LOG: Support -fuse-ld=lld for riscv

Differential Revision: https://reviews.llvm.org/D74704

Added: 
    

Modified: 
    clang/lib/Driver/ToolChains/RISCVToolchain.cpp
    clang/test/Driver/riscv32-toolchain.c

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..1b765dba6b9a 100644
--- a/clang/test/Driver/riscv32-toolchain.c
+++ b/clang/test/Driver/riscv32-toolchain.c
@@ -3,6 +3,10 @@
 // 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
+// RUN: %clang %s -### -no-canonical-prefixes -target riscv32 -fuse-ld=lld 2>&1 | FileCheck -check-prefix=LLD %s
+// 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
 


        


More information about the cfe-commits mailing list