Skip to content

Commit 5c52cc5

Browse files
committed
Plugin: Propagate host executable sanitization flags
1 parent 749742c commit 5c52cc5

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

Libraries/Plugin/Plugin.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -427,6 +427,13 @@ SC::Result SC::PluginCompiler::compileFile(const PluginDefinition& definition, c
427427
SC_TRY(argumentsArena.appendMultipleStrings({"-fno-rtti"}));
428428
}
429429

430+
#if SC_COMPILER_ASAN
431+
SC_TRY(argumentsArena.appendMultipleStrings({"-fsanitize=address,undefined"}));
432+
#if SC_PLATFORM_APPLE
433+
SC_TRY(argumentsArena.appendMultipleStrings({"-fno-sanitize=enum,return,float-divide-by-zero,function,vptr"}));
434+
#endif
435+
#endif
436+
430437
// This is really important on macOS because otherwise symbols exported on some plugin .dylib that
431438
// match the signature and assembly content, will be re-used by other plugin.dylib making the first
432439
// plugin .dylib not re-loadable until the other .dylibs having references to it are unloaded too...
@@ -549,6 +556,9 @@ SC::Result SC::PluginCompiler::link(const PluginDefinition& definition, const Pl
549556
SC_COMPILER_UNUSED(executablePath);
550557
SC_TRY(arena.appendMultipleStrings({"-shared"}));
551558
#endif
559+
#if SC_COMPILER_ASAN
560+
SC_TRY(arena.appendMultipleStrings({"-fsanitize=address,undefined"}));
561+
#endif
552562
#endif
553563

554564
for (auto& file : definition.files)

0 commit comments

Comments
 (0)