Skip to content

Commit

Permalink
[NFC][RISCV] Simplify the dynamic linker construction logic
Browse files Browse the repository at this point in the history
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: llvm#97383
  • Loading branch information
wangpc-pp authored Jul 2, 2024
1 parent cd1e6a5 commit 4468c3d
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions clang/lib/Driver/ToolChains/Linux.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit 4468c3d

Please sign in to comment.