RESOLVED FIXED312514
[CMake] Add mac-asan preset and fix sanitizer link flags
https://bugs.webkit.org/show_bug.cgi?id=312514
Summary [CMake] Add mac-asan preset and fix sanitizer link flags
zak ridouh
Reported 2026-04-16 15:11:23 PDT
Add a mac-asan CMake preset for AddressSanitizer builds and fix two pre-existing bugs that prevented ENABLE_SANITIZERS from working on the Mac port. The mac-asan preset uses RelWithDebInfo (optimized + debuggable), enables ENABLE_SANITIZERS=address, and inherits dev settings (ccache, compile_commands). OptionsMac.cmake now mirrors Configurations/Sanitizers.xcconfig by adding -fsanitize-address-use-after-return=never (disables ASan's fake stack which breaks JSC garbage collection) and -DRELEASE_WITHOUT_OPTIMIZATIONS (prevents ALWAYS_INLINE from defeating sanitizer instrumentation). Both flags are gated to exclude Swift compilation and linking. Fix unquoted CMAKE_SHARED_LINKER_FLAGS appends in WebKit and WebKitLegacy PlatformMac.cmake. Without quotes, CMake treats the expansion as a list, inserting a literal semicolon into the generated Ninja link command, which the shell interprets as a command separator. This was latent when CMAKE_SHARED_LINKER_FLAGS was empty but breaks any build that populates it (e.g. ENABLE_SANITIZERS).
Attachments
Radar WebKit Bug Importer
Comment 1 2026-04-16 15:11:29 PDT
zak ridouh
Comment 2 2026-04-16 15:15:49 PDT
EWS
Comment 3 2026-04-17 13:54:39 PDT
Committed 311472@main (2dbae6f74c8d): <https://commits.webkit.org/311472@main> Reviewed commits have been landed. Closing PR #62926 and removing active labels.
Note You need to log in before you can comment on or make changes to this bug.