From 77dde08b76f00b5f600402c6674643b8b7100b84 Mon Sep 17 00:00:00 2001 From: Brooks Davis Date: Fri, 2 Sep 2016 21:33:05 +0000 Subject: Add a hack to make -fopenmp work inspired by a submission from Johannes Dieterich . 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. --- devel/llvm38/files/clang-patch-fopenmp.diff | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 devel/llvm38/files/clang-patch-fopenmp.diff (limited to 'devel/llvm38/files/clang-patch-fopenmp.diff') diff --git a/devel/llvm38/files/clang-patch-fopenmp.diff b/devel/llvm38/files/clang-patch-fopenmp.diff new file mode 100644 index 000000000000..5216a420e710 --- /dev/null +++ b/devel/llvm38/files/clang-patch-fopenmp.diff @@ -0,0 +1,28 @@ +--- 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. -- cgit v1.2.3