cmake: Pass -fno-sanitize=undefined when building zig2.

We build zig2.c and compiler_rt.c with -O0 but then proceed to link with -O3.
So zig2.o and compiler_rt.o will have references to ubsan-rt symbols, but the
-O3 causes the compiler to not link ubsan-rt. We don't actually need the safety
here, so just explicitly disable ubsan.
This commit is contained in:
Alex Rønne Petersen 2025-04-03 07:24:03 +02:00
parent c3e88a21fb
commit 957a5ae560
No known key found for this signature in database

View File

@ -809,7 +809,7 @@ if(MSVC)
else()
set(ZIG_WASM2C_COMPILE_FLAGS "-std=c99 -O2")
set(ZIG1_COMPILE_FLAGS "-std=c99 -Os")
set(ZIG2_COMPILE_FLAGS "-std=c99 -O0 -fno-stack-protector")
set(ZIG2_COMPILE_FLAGS "-std=c99 -O0 -fno-sanitize=undefined -fno-stack-protector")
if(APPLE)
set(ZIG2_LINK_FLAGS "-Wl,-stack_size,0x10000000")
elseif(MINGW)