[Buildroot] [PATCH v2] package/mesa3d: fix build on m68k
Giulio Benetti
giulio.benetti at benettiengineering.com
Sun Sep 19 00:51:54 UTC 2021
To build mesa3d for m68k we need to pass -mlong-jump-table-offsets CFLAG
since 'switch' blocks are pretty wide and lead to build failure. This way
'switch' blocks will have a 32-bit addressing by default instead of the
standard 16-bit. This can be done only with m68k gcc version >= 7.x
because gcc flag used to fix this(-mlong-jump-table-offsets) is
available only from that version on.
Fixes:
http://autobuild.buildroot.net/results/60c4653c2a93125edbdd0beb43cd47301643464a/
Signed-off-by: Giulio Benetti <giulio.benetti at benettiengineering.com>
---
V1->V2:
* add gcc >= 7.x dependency to Config.in as suggested by Yann Morin
* improve commit log according to Config.in change
---
package/mesa3d/Config.in | 1 +
package/mesa3d/mesa3d.mk | 9 +++++++++
2 files changed, 10 insertions(+)
diff --git a/package/mesa3d/Config.in b/package/mesa3d/Config.in
index eb7c1eef46..e364f435c7 100644
--- a/package/mesa3d/Config.in
+++ b/package/mesa3d/Config.in
@@ -4,6 +4,7 @@ menuconfig BR2_PACKAGE_MESA3D
depends on !BR2_STATIC_LIBS
depends on BR2_TOOLCHAIN_HAS_SYNC_1
depends on BR2_TOOLCHAIN_HAS_THREADS_NPTL
+ depends on !BR2_m68k || BR2_TOOLCHAIN_GCC_AT_LEAST_7 # m68k needs gcc >= 7.x
select BR2_PACKAGE_EXPAT
select BR2_PACKAGE_LIBDRM
select BR2_PACKAGE_WAYLAND_PROTOCOLS if BR2_PACKAGE_WAYLAND
diff --git a/package/mesa3d/mesa3d.mk b/package/mesa3d/mesa3d.mk
index 1a9e355641..f1862aed69 100644
--- a/package/mesa3d/mesa3d.mk
+++ b/package/mesa3d/mesa3d.mk
@@ -259,4 +259,13 @@ else
MESA3D_CONF_OPTS += -Dzstd=disabled
endif
+MESA3D_CFLAGS = $(TARGET_CFLAGS)
+
+# m68k needs 32-bit offsets in switch tables to build
+ifeq ($(BR2_m68k),y)
+MESA3D_CFLAGS += -mlong-jump-table-offsets
+endif
+
+MESA3D_CONF_OPTS += -DCMAKE_C_FLAGS="$(MESA3D_CFLAGS)"
+
$(eval $(meson-package))
--
2.25.1
More information about the buildroot
mailing list