[clang] [driver] return in `addArchSpecificRPath` for AIX and also get the triple without the OS on AIX. (PR #134520)
via cfe-commits
cfe-commits at lists.llvm.org
Sat Apr 5 20:28:46 PDT 2025
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-clang
Author: Daniel Chen (DanielCChen)
<details>
<summary>Changes</summary>
`addArchSpecificRPath` shoudl immediately return for AIX as AIX doesn't support `rpath` option.
`getArchSpecificLibPaths` also needs to get the triple without the OS version on AIX.
---
Full diff: https://github.com/llvm/llvm-project/pull/134520.diff
2 Files Affected:
- (modified) clang/lib/Driver/ToolChain.cpp (+6-1)
- (modified) clang/lib/Driver/ToolChains/CommonArgs.cpp (+3)
``````````diff
diff --git a/clang/lib/Driver/ToolChain.cpp b/clang/lib/Driver/ToolChain.cpp
index 36d0ae34dec86..dd3cc33b5a233 100644
--- a/clang/lib/Driver/ToolChain.cpp
+++ b/clang/lib/Driver/ToolChain.cpp
@@ -999,7 +999,12 @@ ToolChain::path_list ToolChain::getArchSpecificLibPaths() const {
Paths.push_back(std::string(Path));
};
- AddPath({getTriple().str()});
+ // For AIX, get the triple without the OS version.
+ if (Triple.isOSAIX()) {
+ const llvm::Triple &TripleWithoutVersion = getTripleWithoutOSVersion();
+ AddPath({TripleWithoutVersion.str()});
+ } else
+ AddPath({getTriple().str()});
AddPath({getOSLibName(), llvm::Triple::getArchTypeName(getArch())});
return Paths;
}
diff --git a/clang/lib/Driver/ToolChains/CommonArgs.cpp b/clang/lib/Driver/ToolChains/CommonArgs.cpp
index ddeadff8f6dfb..e5d221cbf8b51 100644
--- a/clang/lib/Driver/ToolChains/CommonArgs.cpp
+++ b/clang/lib/Driver/ToolChains/CommonArgs.cpp
@@ -1252,6 +1252,9 @@ void tools::addArchSpecificRPath(const ToolChain &TC, const ArgList &Args,
options::OPT_fno_rtlib_add_rpath, false))
return;
+ if (TC.getTriple().isOSAIX()) // AIX doesn't support -rpath option.
+ return;
+
SmallVector<std::string> CandidateRPaths(TC.getArchSpecificLibPaths());
if (const auto CandidateRPath = TC.getStdlibPath())
CandidateRPaths.emplace_back(*CandidateRPath);
``````````
</details>
https://github.com/llvm/llvm-project/pull/134520
More information about the cfe-commits
mailing list