Bug#1067207: mesa: switch statement too large, might need -mlong-jump-table-offsets

2024-04-01 Thread Thorsten Glaser
retitle 1067207 mesa: [m68k] switch statement too large, needs 
-mlong-jump-table-offsets
tags 1067207 + patch
thanks

>Adding the -mlong-jump-table-offsets flag to CFLAGS on m68k should

That did it. I built with…

APPEND CFLAGS -mlong-jump-table-offsets
APPEND CXXFLAGS -mlong-jump-table-offsets

… in /etc/dpkg/buildflags.conf in the chroot. An equivalent patch
for d/rules would be:

--- debian/rules~   2024-04-01 23:29:11.0 +0200
+++ debian/rules2024-04-01 23:31:39.379936168 +0200
@@ -18,7 +18,11 @@

 export DEB_BUILD_MAINT_OPTIONS=optimize=-lto

-ifeq (,$(filter $(DEB_HOST_ARCH), armhf ppc64el sh3 sh4))
+ifneq (,$(filter $(DEB_HOST_ARCH), m68k))
+# This library has huge jump tables: Debian #1067207
+buildflags = \
+   $(shell DEB_CFLAGS_MAINT_APPEND='-Wall -mlong-jump-table-offsets' 
DEB_CXXFLAGS_MAINT_APPEND='-Wall -mlong-jump-table-offsets' dpkg-buildflags 
--export=configure)
+else ifeq (,$(filter $(DEB_HOST_ARCH), armhf ppc64el sh3 sh4))
 buildflags = \
$(shell DEB_CFLAGS_MAINT_APPEND=-Wall DEB_CXXFLAGS_MAINT_APPEND=-Wall 
dpkg-buildflags --export=configure)
 else

While there, you might want to consider changing these
nested ifs to the new gmake else-if model or perhaps
sorting it, or even changing to something like:

--- debian/rules~   2024-04-01 23:29:11.0 +0200
+++ debian/rules2024-04-01 23:36:10.368947470 +0200
@@ -18,20 +18,25 @@
 
 export DEB_BUILD_MAINT_OPTIONS=optimize=-lto
 
-ifeq (,$(filter $(DEB_HOST_ARCH), armhf ppc64el sh3 sh4))
-buildflags = \
-   $(shell DEB_CFLAGS_MAINT_APPEND=-Wall DEB_CXXFLAGS_MAINT_APPEND=-Wall 
dpkg-buildflags --export=configure)
-else
-  ifneq (,$(filter $(DEB_HOST_ARCH), armhf))
-  # Workaround for a variant of LP: #725126
-  buildflags = \
-   $(shell DEB_CFLAGS_MAINT_APPEND="-Wall -fno-optimize-sibling-calls" 
DEB_CXXFLAGS_MAINT_APPEND="-Wall -fno-optimize-sibling-calls" dpkg-buildflags 
--export=configure)
-  else
-# Workaround for https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83143
-buildflags = \
-   $(shell DEB_CFLAGS_MAINT_APPEND="-Wall -O1" 
DEB_CXXFLAGS_MAINT_APPEND="-Wall -O1" dpkg-buildflags --export=configure)
-  endif
+DEB_CFLAGS_MAINT_APPEND := -Wall
+DEB_CXXFLAGS_MAINT_APPEND := -Wall
+ifneq (,$(filter $(DEB_HOST_ARCH), armhf))
+# Workaround for a variant of LP: #725126
+DEB_CFLAGS_MAINT_APPEND += -fno-optimize-sibling-calls
+DEB_CXXFLAGS_MAINT_APPEND += -fno-optimize-sibling-calls
+else ifneq (,$(filter $(DEB_HOST_ARCH), m68k))
+# This library has huge jump tables: Debian #1067207
+DEB_CFLAGS_MAINT_APPEND += -mlong-jump-table-offsets
+DEB_CXXFLAGS_MAINT_APPEND += -mlong-jump-table-offsets
+else ifneq (,$(filter $(DEB_HOST_ARCH), ppc64el sh3 sh4))
+# Workaround for https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83143
+DEB_CFLAGS_MAINT_APPEND += -O1
+DEB_CXXFLAGS_MAINT_APPEND += -O1
 endif
+buildflags = $(shell \
+   DEB_CFLAGS_MAINT_APPEND='$(DEB_CFLAGS_MAINT_APPEND)' \
+   DEB_CXXFLAGS_MAINT_APPEND='$(DEB_CXXFLAGS_MAINT_APPEND)' \
+   dpkg-buildflags --export=configure)
 
 EGL_PLATFORMS = x11
 GALLIUM_DRIVERS = swrast

bye,
//mirabilos
-- 
When he found out that the m68k port was in a pretty bad shape, he did
not, like many before him, shrug and move on; instead, he took it upon
himself to start compiling things, just so he could compile his shell.
How's that for dedication. -- Wouter, about my Debian/m68k revival



Bug#1067207: mesa: switch statement too large, might need -mlong-jump-table-offsets

2024-03-20 Thread Fabio Pedretti
Maybe it's better to file an issue or send a MR upstream:
https://gitlab.freedesktop.org/mesa/mesa/-/issues
https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests

It looks like m68k was considered in the past:
https://cgit.freedesktop.org/mesa/mesa/log/?qt=grep=m68k



Bug#1067207: mesa: switch statement too large, might need -mlong-jump-table-offsets

2024-03-19 Thread Thorsten Glaser
Source: mesa
Version: 24.0.3-1
Severity: important
Justification: FTBFS on d-ports arch
X-Debbugs-CC: t...@mirbsd.de, debian-...@lists.debian.org
Tags: ftbfs

mesa currently FTBFS on m68k with:

[…]
cc -Isrc/nouveau/headers/libnvidia_headers.a.p […] -o 
src/nouveau/headers/libnvidia_headers.a.p/meson-generated_.._nvk_cla097.c.o -c 
src/nouveau/headers/nvk_cla097.c
/tmp/ccrcAVyk.s: Assembler messages:
/tmp/ccrcAVyk.s:15766: Error: Adjusted signed .word (0x8002) overflows: 
`switch'-statement too large.
/tmp/ccrcAVyk.s:15766: Error: Adjusted signed .word (0x8008) overflows: 
`switch'-statement too large.
[…]

Not sure if it makes sense to exclude building this part of nouveau
on m68k (I do know someone who has added a PCI bus to his Atari and
runs a Radeon on it) or whether other files in this source package
also have huge jump tables.

Adding the -mlong-jump-table-offsets flag to CFLAGS on m68k should
unbreak this; bonus points if you add it to only the files where
it’s needed, if it’s only a few and not expected to change, for example.