[PATCH] D53397: [MinGW] Link to correct openmp library

Peiyuan Song via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Oct 18 06:45:14 PDT 2018


SquallATF created this revision.
Herald added subscribers: cfe-commits, guansong.

Repository:
  rC Clang

https://reviews.llvm.org/D53397

Files:
  lib/Driver/ToolChains/MinGW.cpp


Index: lib/Driver/ToolChains/MinGW.cpp
===================================================================
--- lib/Driver/ToolChains/MinGW.cpp
+++ lib/Driver/ToolChains/MinGW.cpp
@@ -220,8 +220,24 @@
         CmdArgs.push_back("-lssp_nonshared");
         CmdArgs.push_back("-lssp");
       }
-      if (Args.hasArg(options::OPT_fopenmp))
-        CmdArgs.push_back("-lgomp");
+
+      if (Args.hasFlag(options::OPT_fopenmp, options::OPT_fopenmp_EQ,
+                       options::OPT_fno_openmp, false)) {
+        switch (TC.getDriver().getOpenMPRuntime(Args)) {
+        case Driver::OMPRT_OMP:
+          CmdArgs.push_back("-lomp");
+          break;
+        case Driver::OMPRT_IOMP5:
+          CmdArgs.push_back("-liomp5md");
+          break;
+        case Driver::OMPRT_GOMP:
+          CmdArgs.push_back("-lgomp");
+          break;
+        case Driver::OMPRT_Unknown:
+          // Already diagnosed.
+          break;
+        }
+      }
 
       AddLibGCC(Args, CmdArgs);
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D53397.170078.patch
Type: text/x-patch
Size: 990 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20181018/2f7fd015/attachment-0001.bin>


More information about the cfe-commits mailing list