[PATCH] D142174: [OpenMP] Don't set rpath for system paths
Tom Stellard via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Thu Jan 19 20:31:21 PST 2023
tstellar created this revision.
tstellar added reviewers: JonChesterfield, MaskRay.
Herald added subscribers: guansong, yaxunl.
Herald added a project: All.
tstellar requested review of this revision.
Herald added a reviewer: jdoerfert.
Herald added subscribers: cfe-commits, sstefan1.
Herald added a project: clang.
Suggested in https://reviews.llvm.org/D118493#3402001
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D142174
Files:
clang/lib/Driver/ToolChains/CommonArgs.cpp
Index: clang/lib/Driver/ToolChains/CommonArgs.cpp
===================================================================
--- clang/lib/Driver/ToolChains/CommonArgs.cpp
+++ clang/lib/Driver/ToolChains/CommonArgs.cpp
@@ -791,6 +791,13 @@
/*IsLTO=*/true, PluginOptPrefix);
}
+static bool isSystemPath(const StringRef &path) {
+ return llvm::StringSwitch<bool>(path)
+ .Case("/usr/lib", true)
+ .Case("/usr/lib64", true)
+ .Default(false);
+}
+
void tools::addOpenMPRuntimeSpecificRPath(const ToolChain &TC,
const ArgList &Args,
ArgStringList &CmdArgs) {
@@ -802,6 +809,11 @@
SmallString<256> DefaultLibPath =
llvm::sys::path::parent_path(TC.getDriver().Dir);
llvm::sys::path::append(DefaultLibPath, CLANG_INSTALL_LIBDIR_BASENAME);
+
+ // If clang is installed to a 'system path' there is no reason to add rpath.
+ if (isSystemPath(DefaultLibPath))
+ return;
+
CmdArgs.push_back("-rpath");
CmdArgs.push_back(Args.MakeArgString(DefaultLibPath));
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D142174.490707.patch
Type: text/x-patch
Size: 1109 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20230120/016ef70f/attachment.bin>
More information about the cfe-commits
mailing list