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 <giulio.benetti@benettiengineering.com>
[yann.morin.1998@free.fr:
  - add comment
  - reword commit log, add BZ references, add non-propagation notes
]
Signed-off-by: Yann E. MORIN <yann.morin.1998@free.fr>
This commit is contained in:
Giulio Benetti 2021-09-19 02:51:54 +02:00 committed by Yann E. MORIN
parent 02ea01ea22
commit 2fe3a8f81b
2 changed files with 14 additions and 0 deletions

View File

@ -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

View File

@ -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))