[clang] [driver] return in `addArchSpecificRPath` for AIX and also get the triple without the OS on AIX in `getArchSpecificLibPaths`. (PR #134520)
Daniel Chen via cfe-commits
cfe-commits at lists.llvm.org
Tue Apr 15 17:05:32 PDT 2025
https://github.com/DanielCChen updated https://github.com/llvm/llvm-project/pull/134520
>From 1f6eecb06d72acdd5c26d61cac5e88fd7df57005 Mon Sep 17 00:00:00 2001
From: Daniel Chen <cdchen at ca.ibm.com>
Date: Sat, 5 Apr 2025 23:24:09 -0400
Subject: [PATCH 1/2] [driver] return in addArchSpecificRPath for AIX and also
get the triple without the OS on AIX.
---
clang/lib/Driver/ToolChain.cpp | 7 ++++++-
clang/lib/Driver/ToolChains/CommonArgs.cpp | 3 +++
2 files changed, 9 insertions(+), 1 deletion(-)
diff --git a/clang/lib/Driver/ToolChain.cpp b/clang/lib/Driver/ToolChain.cpp
index 97317579c8a50..b2beb3732fffa 100644
--- a/clang/lib/Driver/ToolChain.cpp
+++ b/clang/lib/Driver/ToolChain.cpp
@@ -1015,7 +1015,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);
>From f1c7f40553c162feb5ca3e6290e0f56eb3489f69 Mon Sep 17 00:00:00 2001
From: Daniel Chen <cdchen at ca.ibm.com>
Date: Tue, 15 Apr 2025 20:03:30 -0400
Subject: [PATCH 2/2] To disable getArchSpecificLibPaths on AIX.
---
clang/lib/Driver/ToolChain.cpp | 7 +------
clang/lib/Driver/ToolChains/AIX.h | 2 ++
2 files changed, 3 insertions(+), 6 deletions(-)
diff --git a/clang/lib/Driver/ToolChain.cpp b/clang/lib/Driver/ToolChain.cpp
index b2beb3732fffa..97317579c8a50 100644
--- a/clang/lib/Driver/ToolChain.cpp
+++ b/clang/lib/Driver/ToolChain.cpp
@@ -1015,12 +1015,7 @@ ToolChain::path_list ToolChain::getArchSpecificLibPaths() const {
Paths.push_back(std::string(Path));
};
- // 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({getTriple().str()});
AddPath({getOSLibName(), llvm::Triple::getArchTypeName(getArch())});
return Paths;
}
diff --git a/clang/lib/Driver/ToolChains/AIX.h b/clang/lib/Driver/ToolChains/AIX.h
index 8f130f6b54547..23c93aaf86ba8 100644
--- a/clang/lib/Driver/ToolChains/AIX.h
+++ b/clang/lib/Driver/ToolChains/AIX.h
@@ -98,6 +98,8 @@ class LLVM_LIBRARY_VISIBILITY AIX : public ToolChain {
return llvm::DebuggerKind::DBX;
}
+ path_list getArchSpecificLibPaths() const override { return path_list(); };
+
protected:
Tool *buildAssembler() const override;
Tool *buildLinker() const override;
More information about the cfe-commits
mailing list