Force Thumb for CFI targets.

am: 7ebf9fa3c9

Change-Id: Iebbb2ed3d0458f0e760131abf675b0164dc480fb
This commit is contained in:
Evgenii Stepanov
2017-01-24 20:58:38 +00:00
committed by android-build-merger

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...)