[PATCH] D122592: [OpenMP] Fix library path missing when using OpenMP
Joseph Huber via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Mon Mar 28 09:33:13 PDT 2022
jhuber6 updated this revision to Diff 418617.
jhuber6 added a comment.
IncludePath -> LibraryPath
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D122592/new/
https://reviews.llvm.org/D122592
Files:
clang/lib/Driver/ToolChains/CommonArgs.cpp
clang/lib/Driver/ToolChains/CommonArgs.h
Index: clang/lib/Driver/ToolChains/CommonArgs.h
===================================================================
--- clang/lib/Driver/ToolChains/CommonArgs.h
+++ clang/lib/Driver/ToolChains/CommonArgs.h
@@ -111,6 +111,9 @@
llvm::opt::ArgStringList &CmdArgs);
void addArchSpecificRPath(const ToolChain &TC, const llvm::opt::ArgList &Args,
llvm::opt::ArgStringList &CmdArgs);
+void addOpenMPRuntimeLibraryPath(const ToolChain &TC,
+ const llvm::opt::ArgList &Args,
+ llvm::opt::ArgStringList &CmdArgs);
/// Returns true, if an OpenMP runtime has been added.
bool addOpenMPRuntime(llvm::opt::ArgStringList &CmdArgs, const ToolChain &TC,
const llvm::opt::ArgList &Args,
Index: clang/lib/Driver/ToolChains/CommonArgs.cpp
===================================================================
--- clang/lib/Driver/ToolChains/CommonArgs.cpp
+++ clang/lib/Driver/ToolChains/CommonArgs.cpp
@@ -668,6 +668,17 @@
}
}
+void tools::addOpenMPRuntimeLibraryPath(const ToolChain &TC,
+ const ArgList &Args,
+ ArgStringList &CmdArgs) {
+ // Default to clang lib / lib64 folder, i.e. the same location as device
+ // runtime.
+ SmallString<256> DefaultLibPath =
+ llvm::sys::path::parent_path(TC.getDriver().Dir);
+ llvm::sys::path::append(DefaultLibPath, Twine("lib") + CLANG_LIBDIR_SUFFIX);
+ CmdArgs.push_back(Args.MakeArgString("-L" + DefaultLibPath));
+}
+
void tools::addArchSpecificRPath(const ToolChain &TC, const ArgList &Args,
ArgStringList &CmdArgs) {
// Enable -frtlib-add-rpath by default for the case of VE.
@@ -727,6 +738,7 @@
if (RTKind == Driver::OMPRT_OMP)
addOpenMPRuntimeSpecificRPath(TC, Args, CmdArgs);
+ addOpenMPRuntimeLibraryPath(TC, Args, CmdArgs);
return true;
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D122592.418617.patch
Type: text/x-patch
Size: 1974 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20220328/9a1287a0/attachment-0001.bin>
More information about the cfe-commits
mailing list