From: Giulio Benetti Date: Sun, 19 Sep 2021 00:51:54 +0000 (+0200) Subject: package/mesa3d: fix build on m68k X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=2fe3a8f81b0507260b76e0a2734671e763180e7a;p=buildroot.git package/mesa3d: fix build on m68k mesa3d uses very big switch statements, which causes the build to fail on m68k, beause the offsets there are only 16-bit. We fix that by using -mlong-jump-table-offsets on m68k, to use 32-bit offsets for switch statements, but this is only available starting with gcc 7 [0] [1]. Fixes: http://autobuild.buildroot.net/results/60c4653c2a93125edbdd0beb43cd47301643464a/ Note: we have two packages that select mesa3d, but: package/intel-mediadriver/ -> already depends on x86_64, so implies !m68k package/x11r7/xdriver_xf86-video-imx-viv/ -> imx is an ARM, but xdriver_xf86-video-imx-viv is missing a depends on BR2_arm (although the comments do have that dependency). However, it depends on other imx related packages, and they depend on either arm or aarch64, so that implies !m68k. As such, we do not need to propagate that new dependency. [0] https://gcc.gnu.org/bugzilla/show_bug.cgi?id=57583#c15 [1] https://gcc.gnu.org/bugzilla/show_bug.cgi?id=57583#c16 Signed-off-by: Giulio Benetti [yann.morin.1998@free.fr: - add comment - reword commit log, add BZ references, add non-propagation notes ] Signed-off-by: Yann E. MORIN --- diff --git a/package/mesa3d/Config.in b/package/mesa3d/Config.in index eb7c1eef46..82a40511f1 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 @@ -441,3 +442,7 @@ comment "mesa3d needs a toolchain w/ C++, NPTL, dynamic library" depends on !BR2_INSTALL_LIBSTDCPP || !BR2_TOOLCHAIN_HAS_THREADS_NPTL || \ BR2_STATIC_LIBS depends on BR2_TOOLCHAIN_HAS_SYNC_1 + +comment "mesa3d needs a toolchain w/ gcc >= 7" + depends on BR2_m68k + depends on !BR2_TOOLCHAIN_GCC_AT_LEAST_7 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))