Author: Pengcheng Wang Date: 2024-07-02T14:41:17+08:00 New Revision: 4468c3dd538b3ec6e4c32d0269d8e7ebbeb0bdc5
URL: https://github.com/llvm/llvm-project/commit/4468c3dd538b3ec6e4c32d0269d8e7ebbeb0bdc5 DIFF: https://github.com/llvm/llvm-project/commit/4468c3dd538b3ec6e4c32d0269d8e7ebbeb0bdc5.diff LOG: [NFC][RISCV] Simplify the dynamic linker construction logic The format of dynamic linker is `ld-linux-{arch}-{abi}.so.1`, so we can just get the arch name from arch type. Reviewers: asb, kito-cheng, MaskRay Reviewed By: MaskRay Pull Request: https://github.com/llvm/llvm-project/pull/97383 Added: Modified: clang/lib/Driver/ToolChains/Linux.cpp Removed: ################################################################################ diff --git a/clang/lib/Driver/ToolChains/Linux.cpp b/clang/lib/Driver/ToolChains/Linux.cpp index 49e029e7c9ab7..98a878e1d764d 100644 --- a/clang/lib/Driver/ToolChains/Linux.cpp +++ b/clang/lib/Driver/ToolChains/Linux.cpp @@ -568,16 +568,12 @@ std::string Linux::getDynamicLinker(const ArgList &Args) const { Loader = (tools::ppc::hasPPCAbiArg(Args, "elfv1")) ? "ld64.so.1" : "ld64.so.2"; break; - case llvm::Triple::riscv32: { - StringRef ABIName = tools::riscv::getRISCVABI(Args, Triple); - LibDir = "lib"; - Loader = ("ld-linux-riscv32-" + ABIName + ".so.1").str(); - break; - } + case llvm::Triple::riscv32: case llvm::Triple::riscv64: { + StringRef ArchName = llvm::Triple::getArchTypeName(Arch); StringRef ABIName = tools::riscv::getRISCVABI(Args, Triple); LibDir = "lib"; - Loader = ("ld-linux-riscv64-" + ABIName + ".so.1").str(); + Loader = ("ld-linux-" + ArchName + "-" + ABIName + ".so.1").str(); break; } case llvm::Triple::sparc: _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits