Merge "Add libc++ and libc++_static aliases for SDK builds."
diff --git a/cc/sanitize.go b/cc/sanitize.go
index 6ab6699..79c86aa 100644
--- a/cc/sanitize.go
+++ b/cc/sanitize.go
@@ -136,8 +136,14 @@
s.Undefined = boolPtr(true)
}
- if found, globalSanitizers = removeFromList("address", globalSanitizers); found && s.Address == nil {
- s.Address = boolPtr(true)
+ if found, globalSanitizers = removeFromList("address", globalSanitizers); found {
+ if s.Address == nil {
+ s.Address = boolPtr(true)
+ } else if *s.Address == false {
+ // Coverage w/o address is an error. If globalSanitizers includes both, and the module
+ // disables address, then disable coverage as well.
+ _, globalSanitizers = removeFromList("coverage", globalSanitizers)
+ }
}
if found, globalSanitizers = removeFromList("thread", globalSanitizers); found && s.Thread == nil {
@@ -307,6 +313,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...)