Page MenuHome

ASan/macOS: fix incomplete C/CXX compiler flags.
ClosedPublic

Authored by Ankit Meel (ankitm) on Sep 12 2020, 5:28 PM.

Details

Summary

While testing for rB40dcf686f04f: Support ASan library on macOS for all generators., compiler flags got mixed up and
non-working ASan configuration was committed.

Platform file, which is included after the CMAKE_C_FLAGS_DEBUG etc.,
are set, overwrites those flags instead of appending to them. To fix this,
PLATFORM_CFLAGS is used to pass the -fsanitize=* flags to the C/C++
compiler.

Tested on fresh build using both Xcode and Ninja, with & without ccache.

Also silence a clang warning for multi-config generators:
the object size sanitizer has no effect at -O0, but is explicitly
enabled: -fsanitize=object-size [-Winvalid-command-line-argument]

Diff Detail

Repository
rB Blender
Branch
asanwarn (branched from master)
Build Status
Buildable 10156
Build 10156: arc lint + arc unit

Event Timeline

Ankit Meel (ankitm) requested review of this revision.Sep 12 2020, 5:28 PM
Ankit Meel (ankitm) created this revision.
Ankit Meel (ankitm) edited the summary of this revision. (Show Details)Sep 13 2020, 8:15 AM
  • Fix trailing white-space.
Ankit Meel (ankitm) edited the summary of this revision. (Show Details)Sep 14 2020, 6:35 PM

Can we make platform_apple.cmake not overwrite all CMAKE_C and CMAKE_CXX flags?

That seems like a mistake, we don't do this on Linux and Windows I think.

Ankit Meel (ankitm) added a comment.EditedSep 14 2020, 7:48 PM

I tried using CMAKE_CXX_FLAGS_DEBUG** for these ASan flags and appending to it in platform_apple.cmake file, but all the ADD_CHECK_C{XX}_COMPILER_FLAG tests failed https://developer.blender.org/diffusion/B/browse/master/CMakeLists.txt$1477-1485
so dropped the idea of making that correction.

This revision is now accepted and ready to land.Sep 15 2020, 4:13 PM