[clang] d03f470 - [Clang] Make '-frtlib-add-rpath' include the standard library directory (#86217)
via cfe-commits
cfe-commits at lists.llvm.org
Fri Mar 22 04:54:36 PDT 2024
Author: Joseph Huber
Date: 2024-03-22T06:54:33-05:00
New Revision: d03f470cbdbae3f86469ea4d79bb54d3ef680512
URL: https://github.com/llvm/llvm-project/commit/d03f470cbdbae3f86469ea4d79bb54d3ef680512
DIFF: https://github.com/llvm/llvm-project/commit/d03f470cbdbae3f86469ea4d79bb54d3ef680512.diff
LOG: [Clang] Make '-frtlib-add-rpath' include the standard library directory (#86217)
Summary:
The original intention of the `openmp-add-rpath` option was to add the
rpath to the language runtime directory. However, the current
implementation only adds it to the compiler's resource directory. This
patch adds support for appending the `-rpath` to the compiler's standard
library directory as well. Currently this is `<exe>/../lib/<triple>`.
Added:
Modified:
clang/lib/Driver/ToolChains/CommonArgs.cpp
Removed:
################################################################################
diff --git a/clang/lib/Driver/ToolChains/CommonArgs.cpp b/clang/lib/Driver/ToolChains/CommonArgs.cpp
index 4478865313636d..6b1fbba7abd031 100644
--- a/clang/lib/Driver/ToolChains/CommonArgs.cpp
+++ b/clang/lib/Driver/ToolChains/CommonArgs.cpp
@@ -1142,7 +1142,11 @@ void tools::addArchSpecificRPath(const ToolChain &TC, const ArgList &Args,
options::OPT_fno_rtlib_add_rpath, false))
return;
- for (const auto &CandidateRPath : TC.getArchSpecificLibPaths()) {
+ SmallVector<std::string> CandidateRPaths(TC.getArchSpecificLibPaths());
+ if (const auto CandidateRPath = TC.getStdlibPath())
+ CandidateRPaths.emplace_back(*CandidateRPath);
+
+ for (const auto &CandidateRPath : CandidateRPaths) {
if (TC.getVFS().exists(CandidateRPath)) {
CmdArgs.push_back("-rpath");
CmdArgs.push_back(Args.MakeArgString(CandidateRPath));
More information about the cfe-commits
mailing list