diff mbox series

[1/1] package/highway: fix build with powerpc7

Message ID 20240505084753.38281-1-fontaine.fabrice@gmail.com
State Changes Requested
Headers show
Series [1/1] package/highway: fix build with powerpc7 | expand

Commit Message

Fabrice Fontaine May 5, 2024, 8:47 a.m. UTC
VSX support added by
https://github.com/google/highway/commit/d1768d160bf031f869b18ab456501f2b1b4951da
only supports powerpc8 and above resulting in the following build
failure with powerpc7 since bump to version 1.0.7 in commit
0db3c08daf335571a2b2d18a16d8980ddf4567ab:

In file included from /home/buildroot/instance-0/output-1/build/highway-1.1.0/hwy/highway.h:430,
                 from /home/buildroot/instance-0/output-1/build/highway-1.1.0/hwy/per_target.cc:28,
                 from /home/buildroot/instance-0/output-1/build/highway-1.1.0/hwy/foreach_target.h:244,
                 from /home/buildroot/instance-0/output-1/build/highway-1.1.0/hwy/per_target.cc:27:
/home/buildroot/instance-0/output-1/build/highway-1.1.0/hwy/ops/ppc_vsx-inl.h: In function 'hwy::N_PPC8::Vec128<unsigned char> hwy::N_PPC8::AESRound(hwy::N_PPC8::Vec128<unsigned char>, hwy::N_PPC8::Vec128<unsigned char>)':
/home/buildroot/instance-0/output-1/build/highway-1.1.0/hwy/ops/ppc_vsx-inl.h:4651:41: error: 'vec_cipher_be' was not declared in this scope
 4651 |   return BitCast(du8, detail::CipherVec{vec_cipher_be(
      |                                         ^~~~~~~~~~~~~

Fixes: 0db3c08daf335571a2b2d18a16d8980ddf4567ab
 - http://autobuild.buildroot.org/results/98224f8972f3f84304f81c266d33e118f0e2c900

Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
---
 package/highway/highway.mk | 4 ++++
 1 file changed, 4 insertions(+)

Comments

Thomas Petazzoni May 6, 2024, 7:25 p.m. UTC | #1
Hello Fabrice,

On Sun,  5 May 2024 10:47:53 +0200
Fabrice Fontaine <fontaine.fabrice@gmail.com> wrote:

> +ifeq ($(BR2_powerpc_power7),y)
> +HIGHWAY_CXXFLAGS += -DHWY_DISABLE_PPC8_CRYPTO
> +endif

You're going to hate me, but this really shouldn't require a hack in
Buildroot's packaging. It should be handled directly by the highway
build system/conditional build logic.

BTW, some stuff in hwy/detect_targets.h is weird:

#if HWY_ARCH_PPC && HWY_COMPILER_GCC && defined(__ALTIVEC__) && \
    defined(__VSX__) && defined(__POWER8_VECTOR__) &&           \
    (defined(__CRYPTO__) || defined(HWY_DISABLE_PPC8_CRYPTO))
#define HWY_BASELINE_PPC8 HWY_PPC8
#else
#define HWY_BASELINE_PPC8 0
#endif

Why is this defined(__CRYPTO__) || defined(HWY_DISABLE_PPC8_CRYPTO) ?

So when you *disable* PPC8 crypto, it uses it? Or I am misunderstanding
things?

The problematic code starts with:

  #if !HWY_S390X_HAVE_Z14 && !defined(HWY_DISABLE_PPC8_CRYPTO)

I guess it needs some additional condition to not kick in on Power7.

Could you have a look into this, or report the bug upstream?

Best regards,

Thomas
diff mbox series

Patch

diff --git a/package/highway/highway.mk b/package/highway/highway.mk
index 3eb0d7a4aa..d1ddcc6221 100644
--- a/package/highway/highway.mk
+++ b/package/highway/highway.mk
@@ -45,6 +45,10 @@  ifeq ($(BR2_RISCV_32),y)
 HIGHWAY_CONF_OPTS += -DHWY_CMAKE_RVV=OFF
 endif
 
+ifeq ($(BR2_powerpc_power7),y)
+HIGHWAY_CXXFLAGS += -DHWY_DISABLE_PPC8_CRYPTO
+endif
+
 # Workaround for gcc bug 104028 on m68k.
 # See: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104028
 ifeq ($(BR2_TOOLCHAIN_HAS_GCC_BUG_104028),y)