Add option for using Address and Thread sanitizers
This commit is contained in:
@@ -105,6 +105,7 @@ namespace Flax.Build.Platforms
|
||||
commonArgs.Add("objective-c++");
|
||||
commonArgs.Add("-stdlib=libc++");
|
||||
AddArgsCommon(options, commonArgs);
|
||||
AddClangSanitizerArgs(compileEnvironment.Sanitizers, commonArgs);
|
||||
|
||||
switch (compileEnvironment.CppVersion)
|
||||
{
|
||||
@@ -155,14 +156,24 @@ namespace Flax.Build.Platforms
|
||||
|
||||
commonArgs.Add("-pthread");
|
||||
|
||||
if (compileEnvironment.FavorSizeOrSpeed == FavorSizeOrSpeed.FastCode)
|
||||
commonArgs.Add("-Ofast");
|
||||
else if (compileEnvironment.FavorSizeOrSpeed == FavorSizeOrSpeed.SmallCode)
|
||||
commonArgs.Add("-Os");
|
||||
if (compileEnvironment.Optimization)
|
||||
commonArgs.Add("-O3");
|
||||
if (compileEnvironment.Sanitizers.HasFlag(Sanitizer.Address))
|
||||
{
|
||||
commonArgs.Add("-fno-optimize-sibling-calls");
|
||||
commonArgs.Add("-fno-omit-frame-pointer");
|
||||
if (compileEnvironment.Optimization)
|
||||
commonArgs.Add("-O1");
|
||||
}
|
||||
else
|
||||
commonArgs.Add("-O0");
|
||||
{
|
||||
if (compileEnvironment.FavorSizeOrSpeed == FavorSizeOrSpeed.FastCode)
|
||||
commonArgs.Add("-Ofast");
|
||||
else if (compileEnvironment.FavorSizeOrSpeed == FavorSizeOrSpeed.SmallCode)
|
||||
commonArgs.Add("-Os");
|
||||
if (compileEnvironment.Optimization)
|
||||
commonArgs.Add("-O3");
|
||||
else
|
||||
commonArgs.Add("-O0");
|
||||
}
|
||||
|
||||
if (compileEnvironment.BufferSecurityCheck)
|
||||
commonArgs.Add("-fstack-protector");
|
||||
@@ -240,6 +251,7 @@ namespace Flax.Build.Platforms
|
||||
{
|
||||
args.Add(string.Format("-o \"{0}\"", outputFilePath));
|
||||
AddArgsCommon(options, args);
|
||||
AddClangSanitizerArgs(options.CompileEnv.Sanitizers, args);
|
||||
|
||||
if (isArchive)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user