[PATCH] D141862: [clang][driver][AIX] Add OpenMP runtime if -fopenmp specified
Xing Xue via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Mon Jan 16 09:24:58 PST 2023
xingxue created this revision.
xingxue added reviewers: daltenty, cebowleratibm, kkwli0.
xingxue added a project: LLVM.
Herald added subscribers: guansong, yaxunl.
Herald added a project: All.
xingxue requested review of this revision.
Herald added subscribers: cfe-commits, sstefan1, MaskRay.
Herald added a reviewer: jdoerfert.
Herald added a project: clang.
This patch adds OpenMP runtime to the linker command line if `-fopenmp` is specifed.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D141862
Files:
clang/lib/Driver/ToolChains/AIX.cpp
Index: clang/lib/Driver/ToolChains/AIX.cpp
===================================================================
--- clang/lib/Driver/ToolChains/AIX.cpp
+++ clang/lib/Driver/ToolChains/AIX.cpp
@@ -243,6 +243,25 @@
if (!Args.hasArg(options::OPT_nostdlib, options::OPT_nodefaultlibs)) {
AddRunTimeLibs(ToolChain, D, CmdArgs, Args);
+ // Add OpenMP runtime if -fopenmp is specified.
+ if (Args.hasFlag(options::OPT_fopenmp, options::OPT_fopenmp_EQ,
+ options::OPT_fno_openmp, false)) {
+ switch (ToolChain.getDriver().getOpenMPRuntime(Args)) {
+ case Driver::OMPRT_OMP:
+ CmdArgs.push_back("-lomp");
+ break;
+ case Driver::OMPRT_IOMP5:
+ CmdArgs.push_back("-liomp5");
+ break;
+ case Driver::OMPRT_GOMP:
+ CmdArgs.push_back("-lgomp");
+ break;
+ case Driver::OMPRT_Unknown:
+ // Already diagnosed.
+ break;
+ }
+ }
+
// Support POSIX threads if "-pthreads" or "-pthread" is present.
if (Args.hasArg(options::OPT_pthreads, options::OPT_pthread))
CmdArgs.push_back("-lpthreads");
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D141862.489584.patch
Type: text/x-patch
Size: 1116 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20230116/5e67bcd1/attachment-0001.bin>
More information about the cfe-commits
mailing list