Force Thumb for CFI targets.

Bug: 22033465
Test: bionic device tests
Change-Id: I672ccc970309631fa895b7134a32c0d403a2151e
This commit is contained in:
Evgenii Stepanov
2017-01-20 14:13:06 -08:00
parent 97673c06d8
commit 7ebf9fa3c9

View File

@@ -307,6 +307,11 @@ func (sanitize *sanitize) flags(ctx ModuleContext, flags Flags) Flags {
}
if Bool(sanitize.Properties.Sanitize.Cfi) {
if ctx.Arch().ArchType == android.Arm {
// __cfi_check needs to be built as Thumb (see the code in linker_cfi.cpp). LLVM is not set up
// to do this on a function basis, so force Thumb on the entire module.
flags.RequiredInstructionSet = "thumb"
}
sanitizers = append(sanitizers, "cfi")
cfiFlags := []string{"-flto", "-fsanitize=cfi", "-fsanitize-cfi-cross-dso"}
flags.CFlags = append(flags.CFlags, cfiFlags...)