@@ -82,6 +82,19 @@ base_common = [
8282 ' -fno-strict-aliasing' , # Prevent strict aliasing optimizations
8383]
8484
85+ # macOS SDK 15+ can deadlock in ASan's pre-main global registration when an
86+ # instrumented executable dynamically loads instrumented libraries (Apple
87+ # Feedback FB16513866; FastLED #3642). Keep ASan heap/stack instrumentation and
88+ # UBSan enabled, but disable the affected ASan globals pass on Apple debug
89+ # builds. This must be applied to both runners and every library they load.
90+ apple_asan_dlopen_workaround_args = []
91+ if build_machine .system() == ' darwin'
92+ apple_asan_dlopen_workaround_args = [
93+ ' -mllvm' ,
94+ ' -asan-globals=0' ,
95+ ]
96+ endif
97+
8598# Stack trace preservation flags (used in debug and quick modes only)
8699stack_trace_flags = [
87100 ' -fno-omit-frame-pointer' , # Keep frame pointers for stack traces
@@ -104,7 +117,7 @@ if build_mode == 'debug'
104117 ' -g3' , # Full debug symbols (variables, macros, everything)
105118 ' -fsanitize=address' , # Address sanitizer (detect memory errors)
106119 ' -fsanitize=undefined' , # Undefined behavior sanitizer
107- ]
120+ ] + apple_asan_dlopen_workaround_args
108121elif build_mode == ' quick'
109122 # Quick mode: Default mode for fast development iteration
110123 # No optimization, no debug symbols, no sanitizers
@@ -390,7 +403,7 @@ if build_mode == 'debug'
390403 ' -g3' ,
391404 ' -fsanitize=address' ,
392405 ' -fsanitize=undefined' ,
393- ]
406+ ] + apple_asan_dlopen_workaround_args
394407elif build_mode == ' quick'
395408 runner_cpp_args += stack_trace_flags + [
396409 ' -O1' ,
0 commit comments