From 8e8beec3f1e869b7f1bc051c8fee1b53f4628869 Mon Sep 17 00:00:00 2001 From: Derek Schuff Date: Thu, 1 May 2025 23:09:02 +0000 Subject: [PATCH] Build libSDL with -fwrapv-pointer This works around undefined behavior that is now being exploited by clang. See https://github.com/llvm/llvm-project/pull/130742 --- tools/ports/sdl2.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tools/ports/sdl2.py b/tools/ports/sdl2.py index b8fba24bc2cc4..b9d26d398cb37 100644 --- a/tools/ports/sdl2.py +++ b/tools/ports/sdl2.py @@ -70,7 +70,8 @@ def create(final): srcs += ['thread/%s/%s' % (thread_backend, s) for s in thread_srcs] srcs = [os.path.join(src_dir, 'src', s) for s in srcs] - flags = ['-sUSE_SDL=0'] + # TODO: Remove fwrapv when we update to a version which includes https://github.com/libsdl-org/SDL/pull/12581 + flags = ['-sUSE_SDL=0', '-fwrapv-pointer'] includes = [ports.get_include_dir('SDL2')] if settings.PTHREADS: flags += ['-pthread']