Repository navigation
Build simplification making sanitizer builds work on android - #3688
Conversation
1. Don't add IREE_DEFAULT_COPTS to CMake's global compiler flags. This was apparently a recent change not fitting with the intended purpose of IREE_DEFAULT_COPTS, which is to populate the default copts of iree_cc_* bazel-ish rules. In effect, this means that IREE_DEFAULT_COPTS only affects IREE code and not e.g. third_party code. I needed to change this now because when building with ASan, this caused third_party/llvm-project to build with -fsanitize=address, however on Android we also need to pass a linker flag for that to work, and that wan't being passed to the LLVM build, making it fail. 2. Don't check for compiler support for -fsanitize= flags. If the user explicitly enables a sanitizer, just use it. This only makes a difference to the error message, should not make any change to what succeeds/fails. Again, I needed to make that change now because of the need to pass a linker flag on Android, which there was no way to pass to this CMake compiler-support-check macro.
| message(FATAL_ERROR "The compiler does not support address sanitizer " | ||
| "or is missing configuration for address sanitizer") |
There was a problem hiding this comment.
Don't check for compiler support for -fsanitize= flags.
If the user explicitly enables a sanitizer, just use it.
This only makes a difference to the error message, should
not make any change to what succeeds/fails.
Part of this error check was meant to give a more useful message on MSVC where different flags might be used: #2832 (comment). However, from another look at https://devblogs.microsoft.com/cppblog/addresssanitizer-asan-for-windows-with-msvc/ and https://devblogs.microsoft.com/cppblog/asan-for-windows-x64-and-debug-build-support/, it looks like the same flag is used.
This was apparently a recent change not fitting with the
intended purpose of IREE_DEFAULT_COPTS, which is to populate
the default copts of iree_cc_* bazel-ish rules.
In effect, this means that IREE_DEFAULT_COPTS only affects
IREE code and not e.g. third_party code.
I needed to change
this now because when building with ASan, this caused
third_party/llvm-project to build with -fsanitize=address,
however on Android we also need to pass a linker flag for
that to work, and that wan't being passed to the LLVM
build, making it fail.
If the user explicitly enables a sanitizer, just use it.
This only makes a difference to the error message, should
not make any change to what succeeds/fails.
Again, I needed to make that change now because of the
need to pass a linker flag on Android, which there was
no way to pass to this CMake compiler-support-check macro.