Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 26 Sep 2019 18:24:05 +0000 (UTC)
From:      Dimitry Andric <dim@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-projects@freebsd.org
Subject:   svn commit: r352763 - in projects/clang900-import: contrib/openmp/runtime/src lib share/man/man5 share/mk
Message-ID:  <201909261824.x8QIO55l059757@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: dim
Date: Thu Sep 26 18:24:04 2019
New Revision: 352763
URL: https://svnweb.freebsd.org/changeset/base/352763

Log:
  Enable OpenMP for powerpc64
  
  Summary: When powerpc64 switches to LLVM, use this patch to enable
  OpenMP as well. OpenMP on PPC is only for 64-bits, so don't make a
  32-bit libomp. A change to openmp files is necesssary (under review on
  https://reviews.llvm.org/D67190), because it determines ELF format
  version based on endianness, which is incorrect.
  
  Reviewed by:	alfredo.junior_eldorado.org.br, #manpages
  Differential Revision: https://reviews.freebsd.org/D21532

Modified:
  projects/clang900-import/contrib/openmp/runtime/src/kmp_platform.h
  projects/clang900-import/contrib/openmp/runtime/src/z_Linux_asm.S
  projects/clang900-import/lib/Makefile
  projects/clang900-import/share/man/man5/src.conf.5
  projects/clang900-import/share/mk/src.opts.mk

Modified: projects/clang900-import/contrib/openmp/runtime/src/kmp_platform.h
==============================================================================
--- projects/clang900-import/contrib/openmp/runtime/src/kmp_platform.h	Thu Sep 26 17:07:30 2019	(r352762)
+++ projects/clang900-import/contrib/openmp/runtime/src/kmp_platform.h	Thu Sep 26 18:24:04 2019	(r352763)
@@ -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

Modified: projects/clang900-import/contrib/openmp/runtime/src/z_Linux_asm.S
==============================================================================
--- projects/clang900-import/contrib/openmp/runtime/src/z_Linux_asm.S	Thu Sep 26 17:07:30 2019	(r352762)
+++ projects/clang900-import/contrib/openmp/runtime/src/z_Linux_asm.S	Thu Sep 26 18:24:04 2019	(r352763)
@@ -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: projects/clang900-import/lib/Makefile
==============================================================================
--- projects/clang900-import/lib/Makefile	Thu Sep 26 17:07:30 2019	(r352762)
+++ projects/clang900-import/lib/Makefile	Thu Sep 26 18:24:04 2019	(r352763)
@@ -194,7 +194,9 @@ _libproc=	libproc
 _librtld_db=	librtld_db
 .endif
 
+.if ${MACHINE_ARCH} != "powerpc"
 SUBDIR.${MK_OPENMP}+=	libomp
+.endif
 SUBDIR.${MK_OPENSSL}+=	libmp
 SUBDIR.${MK_PMC}+=	libpmc libpmcstat
 SUBDIR.${MK_RADIUS_SUPPORT}+=	libradius

Modified: projects/clang900-import/share/man/man5/src.conf.5
==============================================================================
--- projects/clang900-import/share/man/man5/src.conf.5	Thu Sep 26 17:07:30 2019	(r352762)
+++ projects/clang900-import/share/man/man5/src.conf.5	Thu Sep 26 18:24:04 2019	(r352763)
@@ -1550,12 +1550,12 @@ Enable building openldap support for kerberos.
 Set to not build LLVM's OpenMP runtime.
 .Pp
 This is a default setting on
-arm/arm, arm/armv6, arm/armv7, arm64/aarch64, mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32, mips/mipselhf, mips/mipshf, mips/mips64elhf, mips/mips64hf, powerpc/powerpc, powerpc/powerpc64, powerpc/powerpcspe, riscv/riscv64 and sparc64/sparc64.
+arm/arm, arm/armv6, arm/armv7, arm64/aarch64, mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32, mips/mipselhf, mips/mipshf, mips/mips64elhf, mips/mips64hf, powerpc/powerpc, powerpc/powerpcspe, riscv/riscv64 and sparc64/sparc64.
 .It Va WITH_OPENMP
 Set to build LLVM's OpenMP runtime.
 .Pp
 This is a default setting on
-amd64/amd64 and i386/i386.
+amd64/amd64, i386/i386 and powerpc/powerpc64.
 .It Va WITHOUT_OPENSSH
 Set to not build OpenSSH.
 .It Va WITHOUT_OPENSSL

Modified: projects/clang900-import/share/mk/src.opts.mk
==============================================================================
--- projects/clang900-import/share/mk/src.opts.mk	Thu Sep 26 17:07:30 2019	(r352762)
+++ projects/clang900-import/share/mk/src.opts.mk	Thu Sep 26 18:24:04 2019	(r352763)
@@ -397,7 +397,8 @@ BROKEN_OPTIONS+=HYPERV
 .endif
 
 # NVME is only aarch64, x86 and powerpc64
-.if ${__T} != "aarch64" && ${__T} != "amd64" && ${__T} != "i386" && ${__T} != "powerpc64"
+.if ${__T} != "aarch64" && ${__T} != "amd64" && ${__T} != "i386" && \
+    ${__T} != "powerpc64"
 BROKEN_OPTIONS+=NVME
 .endif
 
@@ -406,7 +407,8 @@ BROKEN_OPTIONS+=NVME
 BROKEN_OPTIONS+=BSD_CRTBEGIN
 .endif
 
-.if ${COMPILER_FEATURES:Mc++11} && (${__T} == "amd64" || ${__T} == "i386")
+.if ${COMPILER_FEATURES:Mc++11} && \
+    (${__T} == "amd64" || ${__T} == "i386" || ${__T} == "powerpc64")
 __DEFAULT_YES_OPTIONS+=OPENMP
 .else
 __DEFAULT_NO_OPTIONS+=OPENMP



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