From 13f8df8ed6e69f102d71d2040176b9374ff81706 Mon Sep 17 00:00:00 2001 From: Fabrice Fontaine Date: Sat, 6 Jan 2024 23:42:33 +0100 Subject: [PATCH] package/bayer2rgb-neon: fix aarch64 build with BR2_OPTIMIZE_0 Fix the following build failure with aarch64 and BR2_OPTIMIZE_0 raised since commit 0512910e4901edcb78bb1daa4eb3be9bdc4dc8a9: src/convert-neon-body-bayer8.inc.h: In function 'bayer2rgb_convert_neon': src/convert-neon.c:233:17: error: third argument to '__builtin_prefetch' must be a constant 233 | __builtin_prefetch(((void const *)(_addr)) + 64, 0, (_lvl)); \ | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ src/convert-neon-body-bayer8.inc.h:8:9: note: in expansion of macro 'do_prefetch' 8 | do_prefetch(&in[+1*stride - 1], (rows_per_loop) < 3 ? 3 : 0); | ^~~~~~~~~~~ Fixes: - http://autobuild.buildroot.org/results/307c1c448becd99dfba3a17b3ef816db0bb5cad6 Signed-off-by: Fabrice Fontaine Signed-off-by: Thomas Petazzoni --- package/bayer2rgb-neon/bayer2rgb-neon.mk | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/package/bayer2rgb-neon/bayer2rgb-neon.mk b/package/bayer2rgb-neon/bayer2rgb-neon.mk index 212fe76766..5147a985e8 100644 --- a/package/bayer2rgb-neon/bayer2rgb-neon.mk +++ b/package/bayer2rgb-neon/bayer2rgb-neon.mk @@ -19,6 +19,14 @@ ifeq ($(BR2_arm),y) BAYER2RGB_NEON_CFLAGS += -mfpu=neon endif +# __builtin_prefetch() third argument must be a constant, but +# bayer2rgb-neon uses a variable, derived from a constant, so some +# optimization is needed to allow the compiler to turn it into a +# constant, otherwise the build fails +ifeq ($(BR2_OPTIMIZE_0),y) +BAYER2RGB_NEON_CFLAGS += -O1 +endif + BAYER2RGB_NEON_CONF_ENV = CFLAGS="$(BAYER2RGB_NEON_CFLAGS)" $(eval $(autotools-package))