Force Thumb for CFI targets.
Bug: 22033465
Test: bionic device tests
Change-Id: I672ccc970309631fa895b7134a32c0d403a2151e
diff --git a/cc/sanitize.go b/cc/sanitize.go
index 6ab6699..dca58d8 100644
--- a/cc/sanitize.go
+++ b/cc/sanitize.go
@@ -307,6 +307,11 @@
}
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...)