Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 12 Sep 2019 12:49:46 +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: r511878 - in head/devel: llvm90 llvm90/files/openmp xtoolchain-llvm-devel xtoolchain-llvm90
Message-ID:  <201909121249.x8CCnkwo098367@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: brooks
Date: Thu Sep 12 12:49:46 2019
New Revision: 511878
URL: https://svnweb.freebsd.org/changeset/ports/511878

Log:
  llvm90:
  Enable OpenMP on power64. [0]
  
  Add an option to link ld.lld to ld and enable by default on power64. [1]
  
  xtoolchain-llvm-devel:
  Add the ability to disable linking ld.lld to ld in slave ports.
  
  xtoolchain-llvm90:
  Disable linking ld.lld to ld since llvm90 can now do it.
  
  PR:		240516 [0]
  Submitted by:	pkubaj [0]
  Requested by:	kib [1]

Added:
  head/devel/llvm90/files/openmp/
  head/devel/llvm90/files/openmp/patch-projects_openmp_runtime_src_kmp__platform.h   (contents, props changed)
  head/devel/llvm90/files/openmp/patch-projects_openmp_runtime_src_z__Linux__asm.S   (contents, props changed)
Modified:
  head/devel/llvm90/Makefile
  head/devel/llvm90/pkg-plist
  head/devel/xtoolchain-llvm-devel/Makefile
  head/devel/xtoolchain-llvm90/Makefile

Modified: head/devel/llvm90/Makefile
==============================================================================
--- head/devel/llvm90/Makefile	Thu Sep 12 12:06:06 2019	(r511877)
+++ head/devel/llvm90/Makefile	Thu Sep 12 12:49:46 2019	(r511878)
@@ -2,7 +2,7 @@
 
 PORTNAME=	llvm
 DISTVERSION=	9.0.0rc4
-PORTREVISION=	0
+PORTREVISION=	1
 CATEGORIES=	devel lang
 .if ${DISTVERSION:M*rc*}
 MASTER_SITES=  http://prereleases.llvm.org/${LLVM_RELEASE}/${RCDIR}
@@ -66,12 +66,14 @@ CMAKE_ARGS+=	-DPYTHON_EXECUTABLE=${PYTHON_CMD} \
 CFLAGS+=	-DNDEBUG
 CXXFLAGS+=	-DNDEBUG
 
-OPTIONS_DEFINE=	BE_AMDGPU CLANG DOCS EXTRAS LIT LLD LLDB PYCLANG
+OPTIONS_DEFINE=	BE_AMDGPU CLANG DOCS EXTRAS LIT LLD LLD_LINK LLDB PYCLANG
 OPTIONS_DEFINE_amd64=	COMPILER_RT GOLD OPENMP
 OPTIONS_DEFINE_i386=	COMPILER_RT OPENMP
+OPTIONS_DEFINE_powerpc64=	OPENMP
 OPTIONS_DEFAULT=	BE_AMDGPU BE_STANDARD CLANG EXTRAS LIT LLD LLDB PYCLANG
-OPTIONS_DEFAULT_amd64=	COMPILER_RT GOLD OPENMP
+OPTIONS_DEFAULT_amd64=	COMPILER_RT GOLD LLD_LINK OPENMP
 OPTIONS_DEFAULT_i386=	COMPILER_RT OPENMP
+OPTIONS_DEFAULT_powerpc64=	OPENMP
 OPTIONS_SINGLE=		BACKENDS
 OPTIONS_SINGLE_BACKENDS=BE_FREEBSD BE_NATIVE BE_STANDARD
 OPTIONS_SUB=	yes
@@ -115,6 +117,8 @@ LIT_DESC=		Install lit and FileCheck test tools
 LIT_VARS=		_USES_PYTHON=python:3.6+
 LLD_DESC=		Install lld, the LLVM linker
 LLD_DISTFILES=		lld-${DISTVERSION}.src${EXTRACT_SUFX}
+LLD_LINK_DESC=		Link ld.lld as ld to clang uses it
+LLD_LINK_IMPLIES=	LLD
 LLDB_BUILD_DEPENDS=	swig3.0:devel/swig30 \
 			${PY_ENUM34}
 LLDB_DESC=		Install lldb, the LLVM debugger
@@ -124,6 +128,7 @@ LLDB_IMPLIES=		CLANG
 LLDB_PORTDOCS=		lldb
 LLDB_VARS=		_USES_PYTHON=python:3.6+
 OPENMP_DESC=		Install libomp, the LLVM OpenMP runtime library
+OPENMP_EXTRA_PATCHES=	${PATCHDIR}/openmp
 OPENMP_DISTFILES=	openmp-${DISTVERSION}.src${EXTRACT_SUFX}
 PYCLANG_DESC=	Install python bindings to libclang
 PYCLANG_IMPLIES=	CLANG
@@ -533,6 +538,9 @@ post-install-LIT-on:
 	${LN} -f ${STAGEDIR}${LLVM_PREFIX}/bin/FileCheck \
 	    ${STAGEDIR}${PREFIX}/bin/FileCheck${LLVM_SUFFIX}
 
+post-install-LLD_LINK-on:
+	${LN} -s ld.lld ${STAGEDIR}${LOCALBASE}/llvm${LLVM_SUFFIX}/bin/ld
+
 TEST_CMD=	'(cd ${WRKSRC}/test; ${SETENV} ${MAKE_ENV} LD_LIBRARY_PATH=${WRKSRC}/Release/lib ${MAKE_CMD} check-local-lit)'
 do-test:
 	if [ `${ID} -u` = 0 ]; then \
@@ -579,6 +587,7 @@ build-plist:
 		{printf "%%%%COMPILER_RT%%%%"} \
 	    if ($$0 ~ /(${EXTRAS_PATTERN})/) {printf "%%%%EXTRAS%%%%"} \
 	    if ($$0 ~ /(lld|wasm-ld)/ && $$0 !~ /(lldb)/) {printf "%%%%LLD%%%%"} \
+	    if ($$0 ~ /(bin\/ld$$)/) {printf "%%%%LLD_LINK%%%%"} \
 	    if ($$0 ~ /(argdumper|lldb|six.py)/) {printf "%%%%LLDB%%%%"} \
 	    if ($$0 ~ /(lib.*omp|omp.h|ompt.h)/) {printf "%%%%OPENMP%%%%"} \
 	    if ($$0 ~ /(LLVMgold)/) {printf "%%%%GOLD%%%%"} \

Added: head/devel/llvm90/files/openmp/patch-projects_openmp_runtime_src_kmp__platform.h
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/devel/llvm90/files/openmp/patch-projects_openmp_runtime_src_kmp__platform.h	Thu Sep 12 12:49:46 2019	(r511878)
@@ -0,0 +1,33 @@
+--- projects/openmp/runtime/src/kmp_platform.h.orig	2019-01-19 10:56:40 UTC
++++ projects/openmp/runtime/src/kmp_platform.h
+@@ -93,9 +93,9 @@
+ #define KMP_ARCH_X86 0
+ #define KMP_ARCH_X86_64 0
+ #define KMP_ARCH_AARCH64 0
+-#define KMP_ARCH_PPC64_BE 0
+-#define KMP_ARCH_PPC64_LE 0
+-#define KMP_ARCH_PPC64 (KMP_ARCH_PPC64_LE || KMP_ARCH_PPC64_BE)
++#define KMP_ARCH_PPC64_ELFv1 0
++#define KMP_ARCH_PPC64_ELFv2 0
++#define KMP_ARCH_PPC64 (KMP_ARCH_PPC64_ELFv2 || KMP_ARCH_PPC64_ELFv1)
+ #define KMP_ARCH_MIPS 0
+ #define KMP_ARCH_MIPS64 0
+ 
+@@ -117,12 +117,12 @@
+ #undef KMP_ARCH_X86
+ #define KMP_ARCH_X86 1
+ #elif defined __powerpc64__
+-#if defined __LITTLE_ENDIAN__
+-#undef KMP_ARCH_PPC64_LE
+-#define KMP_ARCH_PPC64_LE 1
++#if defined(_CALL_ELF) && _CALL_ELF == 2
++#undef KMP_ARCH_PPC64_ELFv2
++#define KMP_ARCH_PPC64_ELFv2 1
+ #else
+-#undef KMP_ARCH_PPC64_BE
+-#define KMP_ARCH_PPC64_BE 1
++#undef KMP_ARCH_PPC64_ELFv1
++#define KMP_ARCH_PPC64_ELFv1 1
+ #endif
+ #elif defined __aarch64__
+ #undef KMP_ARCH_AARCH64

Added: head/devel/llvm90/files/openmp/patch-projects_openmp_runtime_src_z__Linux__asm.S
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/devel/llvm90/files/openmp/patch-projects_openmp_runtime_src_z__Linux__asm.S	Thu Sep 12 12:49:46 2019	(r511878)
@@ -0,0 +1,62 @@
+--- projects/openmp/runtime/src/z_Linux_asm.S.orig	2019-07-02 13:45:40 UTC
++++ projects/openmp/runtime/src/z_Linux_asm.S
+@@ -1328,12 +1328,12 @@ KMP_LABEL(kmp_1):
+ // return:	r3	(always 1/TRUE)
+ //
+ 	.text
+-# if KMP_ARCH_PPC64_LE
++# if KMP_ARCH_PPC64_ELFv2
+ 	.abiversion 2
+ # endif
+ 	.globl	__kmp_invoke_microtask
+ 
+-# if KMP_ARCH_PPC64_LE
++# if KMP_ARCH_PPC64_ELFv2
+ 	.p2align	4
+ # else
+ 	.p2align	2
+@@ -1341,7 +1341,7 @@ KMP_LABEL(kmp_1):
+ 
+ 	.type	__kmp_invoke_microtask,@function
+ 
+-# if KMP_ARCH_PPC64_LE
++# if KMP_ARCH_PPC64_ELFv2
+ __kmp_invoke_microtask:
+ .Lfunc_begin0:
+ .Lfunc_gep0:
+@@ -1385,7 +1385,7 @@ __kmp_invoke_microtask:
+ 	.cfi_offset lr, 16
+ 
+ // Compute the size necessary for the local stack frame.
+-# if KMP_ARCH_PPC64_LE
++# if KMP_ARCH_PPC64_ELFv2
+ 	li 12, 72
+ # else
+ 	li 12, 88
+@@ -1463,7 +1463,7 @@ __kmp_invoke_microtask:
+ // for the microtask begins 48 + 8*8 == 112 bytes above r1 for ELFv1 and
+ // 32 + 8*8 == 96 bytes above r1 for ELFv2.
+ 	addi 4, 4, 40
+-# if KMP_ARCH_PPC64_LE
++# if KMP_ARCH_PPC64_ELFv2
+ 	addi 12, 1, 88
+ # else
+ 	addi 12, 1, 104
+@@ -1475,7 +1475,7 @@ __kmp_invoke_microtask:
+ 	bdnz .Lnext
+ 
+ .Lcall:
+-# if KMP_ARCH_PPC64_LE
++# if KMP_ARCH_PPC64_ELFv2
+ 	std 2, 24(1)
+ 	mr 12, 3
+ #else
+@@ -1491,7 +1491,7 @@ __kmp_invoke_microtask:
+ 
+ 	mtctr 12
+ 	bctrl
+-# if KMP_ARCH_PPC64_LE
++# if KMP_ARCH_PPC64_ELFv2
+ 	ld 2, 24(1)
+ # else
+ 	ld 2, 40(1)

Modified: head/devel/llvm90/pkg-plist
==============================================================================
--- head/devel/llvm90/pkg-plist	Thu Sep 12 12:06:06 2019	(r511877)
+++ head/devel/llvm90/pkg-plist	Thu Sep 12 12:49:46 2019	(r511878)
@@ -141,6 +141,7 @@ llvm%%LLVM_SUFFIX%%/bin/dsymutil
 %%EXTRAS%%llvm%%LLVM_SUFFIX%%/bin/find-all-symbols
 %%CLANG%%llvm%%LLVM_SUFFIX%%/bin/git-clang-format
 %%CLANG%%llvm%%LLVM_SUFFIX%%/bin/hmaptool
+%%LLD_LINK%%llvm%%LLVM_SUFFIX%%/bin/ld
 %%LLD%%llvm%%LLVM_SUFFIX%%/bin/ld.lld
 %%LLD%%llvm%%LLVM_SUFFIX%%/bin/ld64.lld
 llvm%%LLVM_SUFFIX%%/bin/llc

Modified: head/devel/xtoolchain-llvm-devel/Makefile
==============================================================================
--- head/devel/xtoolchain-llvm-devel/Makefile	Thu Sep 12 12:06:06 2019	(r511877)
+++ head/devel/xtoolchain-llvm-devel/Makefile	Thu Sep 12 12:49:46 2019	(r511878)
@@ -1,7 +1,11 @@
 # $FreeBSD$
 
 PORTNAME=	xtoolchain
+.ifndef NO_LLD_LINK
 PORTVERSION=	0.1
+.else
+PORTVERSION=	0.2
+.endif
 CATEGORIES=	devel
 MASTER_SITES=	# none
 DISTFILES=	# none
@@ -37,11 +41,13 @@ do-install:
 	@${INSTALL_DATA} ${WRKDIR}/xtoolchain.mk \
 		${STAGEDIR}${PREFIX}/share/toolchains/llvm${LLVM_SUFFIX}.mk
 
+.ifndef NO_LLD_LINK
 # XXX: would be better to add -fuse-ld=lld to LDFLAGS, but there isn't
 # yet a mechansim for that.  Link added here, not in devel/llvm* to avoid
 # forcing lld on all users.
 post-install:
 	@${MKDIR} ${STAGEDIR}${LOCALBASE}/llvm${LLVM_SUFFIX}/bin
 	@${LN} -s ld.lld ${STAGEDIR}${LOCALBASE}/llvm${LLVM_SUFFIX}/bin/ld
+.endif
 
 .include <bsd.port.mk>

Modified: head/devel/xtoolchain-llvm90/Makefile
==============================================================================
--- head/devel/xtoolchain-llvm90/Makefile	Thu Sep 12 12:06:06 2019	(r511877)
+++ head/devel/xtoolchain-llvm90/Makefile	Thu Sep 12 12:49:46 2019	(r511878)
@@ -1,6 +1,7 @@
 # $FreeBSD$
 
 LLVM_SUFFIX=90
+NO_LLD_LINK=yes
 
 MASTERDIR=	${.CURDIR}/../xtoolchain-llvm-devel
 



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