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
This commit is contained in:
Vishwath Mohan 2017-01-19 13:54:55 -08:00
parent 1a01e83725
commit 1b017a76e1
3 changed files with 10 additions and 0 deletions

View file

@ -398,6 +398,10 @@ func (c *config) SanitizeDeviceArch() []string {
return append([]string(nil), c.ProductVariables.SanitizeDeviceArch...)
}
func (c *config) EnableCFI() bool {
return Bool(c.ProductVariables.EnableCFI)
}
func (c *config) Android64() bool {
for _, t := range c.Targets[Device] {
if t.Arch.ArchType.Multilib == "lib64" {

View file

@ -124,6 +124,7 @@ type productVariables struct {
UseGoma *bool `json:",omitempty"`
Debuggable *bool `json:",omitempty"`
Eng *bool `json:",omitempty"`
EnableCFI *bool `json:",omitempty"`
VendorPath *string `json:",omitempty"`

View file

@ -161,6 +161,11 @@ func (sanitize *sanitize) begin(ctx BaseModuleContext) {
}
}
if !ctx.AConfig().EnableCFI() {
s.Cfi = nil
s.Diag.Cfi = nil
}
if ctx.staticBinary() {
s.Address = nil
s.Coverage = nil