[PATCH] arch,cmake: compile ppc.c on all powerpc machines
authorKefu Chai <tchaikov@gmail.com>
Sun, 29 Aug 2021 14:24:30 +0000 (22:24 +0800)
committerThomas Goirand <zigo@debian.org>
Mon, 10 Jan 2022 10:45:19 +0000 (10:45 +0000)
commit3d882ce5e550ea376fab37ca7c7630d53b0bc502
tree3c4d924b7f1f89bba1ea8ac300e5fd96c7c61dd2
parent3a37b2f1d4d7b7342078199b98fa621a3166d843
[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>
Gbp-Pq: Name compile-ppc.c-on-all-powerpc-machines.patch
cmake/modules/SIMDExt.cmake
src/arch/CMakeLists.txt