Disable LTO when building with fuzzer support.
Bug: 131771163 LTO is currently broken when building with SANITIZE_TARGET=fuzzer. The compiler bug is currently being addressed upstream (see linked bug), but we have applied a local workaround in the build system to disable LTO when building using the fuzzer config. There is a bug here however. In the sanitizer mutator we explicitly remove -flto and add -fno-lto. The sanitizer mutator runs after the LTO mutator, so (in general) this works just fine. The problem exists when a target specifies an explicit 'lto: { ... }' flag in their Android.bp. In this case, the sanitizer mutator disables LTO, then the flags are parsed from the Android.bp, re-enabling LTO. This patch fixes this issue. If the sanitizer mutator has added the -fsanitize=fuzzer-no-link flags, then the LTO mutator won't add the LTO flags after this fact. Test: Build a target with SANITIZE_TARGET=fuzzer (or a cc_fuzz target), where there is an explitiy 'lto: { ... }' and watch it now succeed in building. Change-Id: I6643909417f666539c23469816926b806e204b06
Loading
Please register or sign in to comment