[PATCH] D11932: [OPENMP] Link libomp.lib on Windows
Alexey Bataev via cfe-commits
cfe-commits at lists.llvm.org
Tue Aug 11 03:07:03 PDT 2015
ABataev created this revision.
ABataev added reviewers: chandlerc, rsmith.
ABataev added a subscriber: cfe-commits.
Adds libomp.lib for -fopenmp=libomp and libiomp5md.lib for -fopenmp=libiomp5 on Windows
http://reviews.llvm.org/D11932
Files:
lib/Driver/Tools.cpp
test/OpenMP/linking.c
Index: lib/Driver/Tools.cpp
===================================================================
--- lib/Driver/Tools.cpp
+++ lib/Driver/Tools.cpp
@@ -8878,6 +8878,25 @@
Args.AddAllArgValues(CmdArgs, options::OPT__SLASH_link);
+ if (Args.hasFlag(options::OPT_fopenmp, options::OPT_fopenmp_EQ,
+ options::OPT_fno_openmp, false)) {
+ CmdArgs.push_back("-nodefaultlib:vcomp.lib");
+ CmdArgs.push_back("-nodefaultlib:vcompd.lib");
+ switch (getOpenMPRuntime(getToolChain(), Args)) {
+ case OMPRT_OMP:
+ CmdArgs.push_back("-defaultlib:libomp.lib");
+ break;
+ case OMPRT_IOMP5:
+ CmdArgs.push_back("-defaultlib:libiomp5md.lib");
+ break;
+ case OMPRT_GOMP:
+ break;
+ case OMPRT_Unknown:
+ // Already diagnosed.
+ break;
+ }
+ }
+
// Add filenames, libraries, and other linker inputs.
for (const auto &Input : Inputs) {
if (Input.isFilename()) {
Index: test/OpenMP/linking.c
===================================================================
--- test/OpenMP/linking.c
+++ test/OpenMP/linking.c
@@ -69,3 +69,15 @@
// CHECK-LD-OVERRIDE-64: "-lgomp" "-lrt" "-lgcc"
// CHECK-LD-OVERRIDE-64: "-lpthread" "-lc"
//
+// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
+// RUN: -fopenmp=libomp -target x86_64-msvc-win32 \
+// RUN: | FileCheck --check-prefix=CHECK-MSVC-LINK-64 %s
+// CHECK-MSVC-LINK-64: "link.exe"
+// CHECK-MSVC-LINK-64-SAME: "-nodefaultlib:vcomp.lib" "-nodefaultlib:vcompd.lib" "-defaultlib:libomp.lib"
+//
+// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
+// RUN: -fopenmp=libiomp5 -target x86_64-msvc-win32 \
+// RUN: | FileCheck --check-prefix=CHECK-MSVC-ILINK-64 %s
+// CHECK-MSVC-ILINK-64: "link.exe"
+// CHECK-MSVC-ILINK-64-SAME: "-nodefaultlib:vcomp.lib" "-nodefaultlib:vcompd.lib" "-defaultlib:libiomp5md.lib"
+//
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D11932.31780.patch
Type: text/x-patch
Size: 1862 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20150811/10762bc3/attachment.bin>
More information about the cfe-commits
mailing list