Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 5 Aug 2020 22:14:16 +0000 (UTC)
From:      Brooks Davis <brooks@FreeBSD.org>
To:        ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org
Subject:   svn commit: r544246 - in head/devel/llvm10: . files/clang files/openmp
Message-ID:  <202008052214.075MEGik085084@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: brooks
Date: Wed Aug  5 22:14:16 2020
New Revision: 544246
URL: https://svnweb.freebsd.org/changeset/ports/544246

Log:
  Minor fixes.
  
  Unbreak OPENMP in some cases.
  
  Fix C++ library selection for some target values.
  
  PR:		248384, 248386
  Submitted by:	Greg V
  Differential Revision:	https://reviews.freebsd.org/D24420

Added:
  head/devel/llvm10/files/clang/patch-D77776
     - copied unchanged from r543629, head/devel/llvm90/files/clang/patch-D77776
  head/devel/llvm10/files/openmp/
  head/devel/llvm10/files/openmp/patch-ea99c09   (contents, props changed)
Modified:
  head/devel/llvm10/Makefile

Modified: head/devel/llvm10/Makefile
==============================================================================
--- head/devel/llvm10/Makefile	Wed Aug  5 21:55:48 2020	(r544245)
+++ head/devel/llvm10/Makefile	Wed Aug  5 22:14:16 2020	(r544246)
@@ -2,7 +2,7 @@
 
 PORTNAME=	llvm
 DISTVERSION=	10.0.1
-PORTREVISION=	0
+PORTREVISION=	1
 CATEGORIES=	devel lang
 MASTER_SITES=	https://github.com/llvm/llvm-project/releases/download/llvmorg-${DISTVERSION:S/rc/-rc/}/ \
 		https://${PRE_}releases.llvm.org/${LLVM_RELEASE}/${RCDIR}
@@ -141,6 +141,7 @@ LLDB_PORTDOCS=		lldb
 LLDB_VARS=		_USES_PYTHON=python:3.6+
 OPENMP_DESC=		Install libomp, the LLVM OpenMP runtime library
 OPENMP_DISTFILES=	openmp-${DISTVERSION}.src${EXTRACT_SUFX}
+OPENMP_EXTRA_PATCHES=	openmp
 PYCLANG_DESC=	Install python bindings to libclang
 PYCLANG_IMPLIES=	CLANG
 PYCLANG_VARS=	_USES_PYTHON=python:3.6+

Copied: head/devel/llvm10/files/clang/patch-D77776 (from r543629, head/devel/llvm90/files/clang/patch-D77776)
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/devel/llvm10/files/clang/patch-D77776	Wed Aug  5 22:14:16 2020	(r544246, copy of r543629, head/devel/llvm90/files/clang/patch-D77776)
@@ -0,0 +1,20 @@
+[Driver] Default to libc++ on FreeBSD
+
+Downstream may naively translate between DSL and LLVM target
+triple. If OS version is lost in the process then Clang would
+default to a version that's no longer supported by OS vendor.
+
+https://reviews.llvm.org/D77776
+
+--- tools/clang/lib/Driver/ToolChains/FreeBSD.cpp.orig	2019-12-11 19:15:30 UTC
++++ tools/clang/lib/Driver/ToolChains/FreeBSD.cpp
+@@ -351,7 +351,8 @@ FreeBSD::FreeBSD(const Driver &D, const llvm::Triple &
+ }
+ 
+ ToolChain::CXXStdlibType FreeBSD::GetDefaultCXXStdlibType() const {
+-  if (getTriple().getOSMajorVersion() >= 10)
++  unsigned Major = getTriple().getOSMajorVersion();
++  if (Major >= 10 || Major == 0)
+     return ToolChain::CST_Libcxx;
+   return ToolChain::CST_Libstdcxx;
+ }

Added: head/devel/llvm10/files/openmp/patch-ea99c09
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/devel/llvm10/files/openmp/patch-ea99c09	Wed Aug  5 22:14:16 2020	(r544246)
@@ -0,0 +1,62 @@
+commit ea99c09963488130ec0a61ef39df3fd0fcecad3c
+Author: David Carlier <devnexen@gmail.com>
+Date:   Mon Jan 20 18:52:10 2020 +0000
+
+    [OpenMP] affinity little fix for FreeBSD
+    
+    - pthread affinity np has different semantic than sched affinity counterpart. On success returns strictly 0.
+    
+    Reviewers: chandlerc, AndreyChurbanov, jdoerfert
+    
+    Reviewed By: jdoerfert
+    
+    Differential Revision: https://reviews.llvm.org/D72132
+
+diff --git a/openmp/runtime/src/kmp_affinity.h b/openmp/runtime/src/kmp_affinity.h
+index f270bb6dbb8..664a4239319 100644
+--- a/openmp/runtime/src/kmp_affinity.h
++++ b/openmp/runtime/src/kmp_affinity.h
+@@ -303,8 +303,9 @@ class KMPNativeAffinity : public KMPAffinity {
+       int retval =
+           syscall(__NR_sched_getaffinity, 0, __kmp_affin_mask_size, mask);
+ #elif KMP_OS_FREEBSD
+-      int retval =
++      int r =
+           pthread_getaffinity_np(pthread_self(), __kmp_affin_mask_size, reinterpret_cast<cpuset_t *>(mask));
++      int retval = (r == 0 ? 0 : -1);
+ #endif
+       if (retval >= 0) {
+         return 0;
+@@ -322,8 +323,9 @@ class KMPNativeAffinity : public KMPAffinity {
+       int retval =
+           syscall(__NR_sched_setaffinity, 0, __kmp_affin_mask_size, mask);
+ #elif KMP_OS_FREEBSD
+-      int retval =
++      int r =
+           pthread_setaffinity_np(pthread_self(), __kmp_affin_mask_size, reinterpret_cast<cpuset_t *>(mask));
++      int retval = (r == 0 ? 0 : -1);
+ #endif
+       if (retval >= 0) {
+         return 0;
+diff --git a/openmp/runtime/src/z_Linux_util.cpp b/openmp/runtime/src/z_Linux_util.cpp
+index 1daa3d31047..5e2d1bd4a2f 100644
+--- a/openmp/runtime/src/z_Linux_util.cpp
++++ b/openmp/runtime/src/z_Linux_util.cpp
+@@ -164,7 +164,7 @@ void __kmp_affinity_determine_capable(const char *env_var) {
+   if (gCode > 0) { // Linux* OS only
+     // The optimal situation: the OS returns the size of the buffer it expects.
+     //
+-    // A verification of correct behavior is that Isetaffinity on a NULL
++    // A verification of correct behavior is that setaffinity on a NULL
+     // buffer with the same size fails with errno set to EFAULT.
+     sCode = syscall(__NR_sched_setaffinity, 0, gCode, NULL);
+     KA_TRACE(30, ("__kmp_affinity_determine_capable: "
+@@ -286,7 +286,7 @@ void __kmp_affinity_determine_capable(const char *env_var) {
+   if (gCode == 0) {
+     KMP_AFFINITY_ENABLE(KMP_CPU_SET_SIZE_LIMIT);
+     KA_TRACE(10, ("__kmp_affinity_determine_capable: "
+-                  "affinity supported (mask size %d)\n"<
++                  "affinity supported (mask size %d)\n",
+ 		  (int)__kmp_affin_mask_size));
+     KMP_INTERNAL_FREE(buf);
+     return;



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202008052214.075MEGik085084>