ports/devel/llvm38/files/clang-patch-fopenmp.diff
Brooks Davis 77dde08b76 Add a hack to make -fopenmp work inspired by a submission from
Johannes Dieterich <dieterich@ogolem.org>.

This differs from the submission in that it adds the library directly
to the linker command line.  I chose not to add the llvm library to the
search path because that would (e.g.) make it hard to link something
that uses a different version of llvm.
2016-09-02 21:33:05 +00:00

28 lines
1.2 KiB
Diff

--- tools/clang/lib/Driver/Tools.cpp.orig 2016-09-02 19:55:01.000873648 +0000
+++ tools/clang/lib/Driver/Tools.cpp 2016-09-02 19:54:32.001875868 +0000
@@ -2733,13 +2733,22 @@
switch (getOpenMPRuntime(TC, Args)) {
case OMPRT_OMP:
- CmdArgs.push_back("-lomp");
+ if (TC.getTriple().getOS() != llvm::Triple::FreeBSD || TC.isCrossCompiling() || !llvm::sys::fs::exists("%%LLVM_PREFIX%%/lib/libomp.so"))
+ CmdArgs.push_back("-lomp");
+ else
+ CmdArgs.push_back("%%LLVM_PREFIX%%/lib/libomp.so");
break;
case OMPRT_GOMP:
- CmdArgs.push_back("-lgomp");
+ if (TC.getTriple().getOS() != llvm::Triple::FreeBSD || TC.isCrossCompiling() || !llvm::sys::fs::exists("%%LLVM_PREFIX%%/lib/libomp.so"))
+ CmdArgs.push_back("-lgomp");
+ else
+ CmdArgs.push_back("%%LLVM_PREFIX%%/lib/libgomp.so");
break;
case OMPRT_IOMP5:
- CmdArgs.push_back("-liomp5");
+ if (TC.getTriple().getOS() != llvm::Triple::FreeBSD || TC.isCrossCompiling() || !llvm::sys::fs::exists("%%LLVM_PREFIX%%/lib/libomp.so"))
+ CmdArgs.push_back("-liomp5");
+ else
+ CmdArgs.push_back("%%LLVM_PREFIX%%/lib/libiomp5.so");
break;
case OMPRT_Unknown:
// Already diagnosed.