summaryrefslogtreecommitdiffstats
path: root/debian/patches/compile-ppc.c-on-all-powerpc-machines.patch
diff options
context:
space:
mode:
Diffstat (limited to 'debian/patches/compile-ppc.c-on-all-powerpc-machines.patch')
-rw-r--r--debian/patches/compile-ppc.c-on-all-powerpc-machines.patch92
1 files changed, 92 insertions, 0 deletions
diff --git a/debian/patches/compile-ppc.c-on-all-powerpc-machines.patch b/debian/patches/compile-ppc.c-on-all-powerpc-machines.patch
new file mode 100644
index 000000000..888d58919
--- /dev/null
+++ b/debian/patches/compile-ppc.c-on-all-powerpc-machines.patch
@@ -0,0 +1,92 @@
+From 1b9ad6ca971d2c6222f1fb405ae620a32159cd5d Mon Sep 17 00:00:00 2001
+From: Kefu Chai <tchaikov@gmail.com>
+Date: Sun, 29 Aug 2021 22:24:30 +0800
+Subject: [PATCH] arch,cmake: compile ppc.c on all powerpc machines
+
+* cmake/modules/SIMDExt.cmake: define HAVE_PPC for 32-bit PowerPC.
+* src/arch/CMakeLists.txt: compile ppc.c for all PowerPC architectures,
+ including powerpc (32-bit PowerPC), ppc64el (64-bit Little Endian
+ PowerPC) and ppc64 (64-bit Big Endian PowerPC).
+
+before this change, ppc.c is only compiled if HAVE_POWER8 is defined.
+but Power8 is a 64-bit PowerPC architecture. while in src/arch/probe.cc,
+we check for `defined(__powerpc__) || defined(__ppc__)`, if this is
+true, ceph_arch_ppc_probe() is used to check for the support of
+Altivec. but on non-power8 PowerPC machines, the linker fails to find the
+symbols like ceph_arch_ppc_probe(), as ppc.c is not compiled on them.
+
+in this change, ppc.c is compiled on all PowerPC architectures, so that
+ceph_arch_ppc_probe() is also available on non-power8 machines. this
+change does not impact the behavior of non-power8 machines. because
+on them, the runtime check would fail to detect the existence of
+PPC_FEATURE2_VEC_CRYPTO instructions.
+
+Reported-by: Mattias Ellert <mattias.ellert@physics.uu.se>
+Signed-off-by: Kefu Chai <tchaikov@gmail.com>
+---
+ cmake/modules/SIMDExt.cmake | 17 ++++++++++++++---
+ src/arch/CMakeLists.txt | 2 +-
+ 2 files changed, 15 insertions(+), 4 deletions(-)
+
+Index: ceph/cmake/modules/SIMDExt.cmake
+===================================================================
+--- ceph.orig/cmake/modules/SIMDExt.cmake
++++ ceph/cmake/modules/SIMDExt.cmake
+@@ -1,8 +1,13 @@
+ # detect SIMD extensions
+ #
++# HAVE_ARM
+ # HAVE_ARMV8_CRC
++# HAVE_ARMV8_CRC_CRYPTO_INTRINSICS
++# HAVE_ARMV8_CRYPTO
+ # HAVE_ARMV8_SIMD
+ # HAVE_ARM_NEON
++#
++# HAVE_INTEL
+ # HAVE_INTEL_SSE
+ # HAVE_INTEL_SSE2
+ # HAVE_INTEL_SSE3
+@@ -11,6 +16,10 @@
+ # HAVE_INTEL_SSE4_1
+ # HAVE_INTEL_SSE4_2
+ #
++# HAVE_PPC64LE
++# HAVE_PPC64
++# HAVE_PPC
++#
+ # SIMD_COMPILE_FLAGS
+ #
+
+@@ -82,14 +91,16 @@ elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "i
+ endif()
+ endif(CMAKE_SYSTEM_PROCESSOR MATCHES "amd64|x86_64|AMD64")
+ endif(CMAKE_SYSTEM_PROCESSOR MATCHES "i686|amd64|x86_64|AMD64")
+-elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "(powerpc|ppc)64|(powerpc|ppc)64le")
++elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "(powerpc|ppc)")
+ if(CMAKE_SYSTEM_PROCESSOR MATCHES "(powerpc|ppc)64le")
+ set(HAVE_PPC64LE 1)
+ message(STATUS " we are ppc64le")
+- else()
++ elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "(powerpc|ppc)64")
+ set(HAVE_PPC64 1)
+ message(STATUS " we are ppc64")
+- endif(CMAKE_SYSTEM_PROCESSOR MATCHES "(powerpc|ppc)64le")
++ else()
++ set(HAVE_PPC 1)
++ endif()
+ CHECK_C_COMPILER_FLAG("-maltivec" HAS_ALTIVEC)
+ if(HAS_ALTIVEC)
+ message(STATUS " HAS_ALTIVEC yes")
+Index: ceph/src/arch/CMakeLists.txt
+===================================================================
+--- ceph.orig/src/arch/CMakeLists.txt
++++ ceph/src/arch/CMakeLists.txt
+@@ -5,7 +5,7 @@ if(HAVE_ARM)
+ list(APPEND arch_srcs arm.c)
+ elseif(HAVE_INTEL)
+ list(APPEND arch_srcs intel.c)
+-elseif(HAVE_POWER8)
++elseif(HAVE_PPC64LE OR HAVE_PPC64 OR HAVE_PPC)
+ list(APPEND arch_srcs ppc.c)
+ endif()
+