Hide CFI behind a global flag.
This CL ensures that locally enabling CFI in a .bp file is not honored
unless it is enabled globally using ENABLE_CFI=true first, effectively
hiding it behind a flag.
Bug: 30227045
Bug: 22033465
Test: m -j40 works and device boots
Test: cfi is correctly honored only when the global flag is set.
Change-Id: Iccc6e4bf5e7828ab8ce6056f3e40922712faa0d8
diff --git a/cc/sanitize.go b/cc/sanitize.go
index 447c5b4..6ab6699 100644
--- a/cc/sanitize.go
+++ b/cc/sanitize.go
@@ -161,6 +161,11 @@
}
}
+ if !ctx.AConfig().EnableCFI() {
+ s.Cfi = nil
+ s.Diag.Cfi = nil
+ }
+
if ctx.staticBinary() {
s.Address = nil
s.Coverage = nil