Skip to content

Commit c3d5ad2

Browse files
committed
mame - fix rpi3 build on 32bit arm userland with aarch64 kernel
Workaround g++-12 compiler bug/compilation issue on 32bit arm userland with aarch64 kernel on the rpi3 (cortex-a53) Disabling -ftree-slp-vectorize works around the issue: {standard input}: Assembler messages: {standard input}:4045: Error: co-processor offset out of range make[2]: *** [skeleton.make:2727: obj/Release/src/mame/skeleton/scopus.o] Error 1 Add arch_opts_cxx array to handle adding additional parameters to ARCHOPTS_CXX.
1 parent ded0a28 commit c3d5ad2

File tree

1 file changed

+19
-1
lines changed

1 file changed

+19
-1
lines changed

scriptmodules/emulators/mame.sh

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,26 @@ function build_mame() {
5252

5353
local params=(NOWERROR=1 ARCHOPTS="-U_FORTIFY_SOURCE -Wl,-s" PYTHON_EXECUTABLE=python3 OPTIMIZE=2 USE_SYSTEM_LIB_FLAC=1)
5454
isPlatform "x11" && params+=(USE_QTDEBUG=1) || params+=(USE_QTDEBUG=0)
55+
56+
# array for storing ARCHOPTS_CXX parameters
57+
local arch_opts_cxx=()
58+
5559
# when building on ARM enable 'fsigned-char' for compiled code, fixes crashes in a few drivers
56-
isPlatform "arm" || isPlatform "aarch64" && params+=(ARCHOPTS_CXX=-fsigned-char)
60+
isPlatform "arm" || isPlatform "aarch64" && arch_opts_cxx+=(-fsigned-char)
61+
62+
# workaround g++-12 compiler bug/compilation issue on 32bit arm userland with aarch64 kernel on the rpi3 (cortex-a53)
63+
# disabling -ftree-slp-vectorize works around the issue:
64+
# {standard input}: Assembler messages:
65+
# {standard input}:4045: Error: co-processor offset out of range
66+
# make[2]: *** [skeleton.make:2727: obj/Release/src/mame/skeleton/scopus.o] Error 1
67+
if [[ "$__gcc_version" -eq 12 ]] && isPlatform "rpi3" && isPlatform "32bit" && [[ "$(uname -m)" == "aarch64" ]]; then
68+
arch_opts_cxx+=(-fno-tree-slp-vectorize)
69+
fi
70+
71+
# if we have any arch opts set, add them
72+
if [[ ${#arch_opts_cxx[@]} -gt 0 ]]; then
73+
params+=(ARCHOPTS_CXX="${arch_opts_cxx[*]}")
74+
fi
5775

5876
# force arm on arm platform - fixes building mame on when using 32bit arm userland with aarch64 kernel
5977
isPlatform "arm" && params+=(PLATFORM=arm)

0 commit comments

Comments
 (0)