Support sanitizer variants inside make builds
Create both sanitized and unsanitized variants inside make builds with sanitizers enabled. Only export the sanitized version to make, and always install the sanitized version in /data to match the make build. Change-Id: I5a17bcbddc7a9d871c929c84d3c116228ef3258f
This commit is contained in:
@@ -24,6 +24,11 @@ import (
|
||||
)
|
||||
|
||||
func (c *Module) AndroidMk() (ret android.AndroidMkData, err error) {
|
||||
if c.Properties.HideFromMake {
|
||||
ret.Disabled = true
|
||||
return ret, nil
|
||||
}
|
||||
|
||||
ret.OutputFile = c.outputFile
|
||||
ret.Extra = append(ret.Extra, func(w io.Writer, outputFile android.Path) (err error) {
|
||||
fmt.Fprintln(w, "LOCAL_SANITIZE := never")
|
||||
|
20
cc/cc.go
20
cc/cc.go
@@ -427,6 +427,7 @@ type BaseProperties struct {
|
||||
No_default_compiler_flags *bool
|
||||
|
||||
AndroidMkSharedLibs []string `blueprint:"mutated"`
|
||||
HideFromMake bool `blueprint:"mutated"`
|
||||
}
|
||||
|
||||
type InstallerProperties struct {
|
||||
@@ -992,20 +993,6 @@ func (c *Module) InstallInData() bool {
|
||||
return c.installer.inData()
|
||||
}
|
||||
|
||||
type appendVariantName interface {
|
||||
appendVariantName(string)
|
||||
}
|
||||
|
||||
func (c *Module) appendVariantName(name string) {
|
||||
if c.linker == nil {
|
||||
return
|
||||
}
|
||||
|
||||
if l, ok := c.linker.(appendVariantName); ok {
|
||||
l.appendVariantName(name)
|
||||
}
|
||||
}
|
||||
|
||||
// Compiler
|
||||
|
||||
type baseCompiler struct {
|
||||
@@ -1476,7 +1463,6 @@ type libraryLinker struct {
|
||||
}
|
||||
|
||||
var _ linker = (*libraryLinker)(nil)
|
||||
var _ appendVariantName = (*libraryLinker)(nil)
|
||||
|
||||
func (library *libraryLinker) props() []interface{} {
|
||||
props := library.baseLinker.props()
|
||||
@@ -1667,10 +1653,6 @@ func (library *libraryLinker) installable() bool {
|
||||
return !library.static()
|
||||
}
|
||||
|
||||
func (library *libraryLinker) appendVariantName(variant string) {
|
||||
library.Properties.VariantName += variant
|
||||
}
|
||||
|
||||
type libraryInstaller struct {
|
||||
baseInstaller
|
||||
|
||||
|
@@ -335,17 +335,14 @@ func sanitizerMutator(t sanitizerType) func(android.BottomUpMutatorContext) {
|
||||
modules[0].(*Module).sanitize.Properties.InData = true
|
||||
}
|
||||
} else if c.sanitize.Properties.SanitizeDep {
|
||||
modules := mctx.CreateVariations("", t.String())
|
||||
modules[0].(*Module).sanitize.SetSanitizer(t, false)
|
||||
modules[1].(*Module).sanitize.SetSanitizer(t, true)
|
||||
modules[0].(*Module).sanitize.Properties.SanitizeDep = false
|
||||
modules[1].(*Module).sanitize.Properties.SanitizeDep = false
|
||||
modules[1].(*Module).sanitize.Properties.InData = true
|
||||
if mctx.AConfig().EmbeddedInMake() {
|
||||
modules := mctx.CreateVariations(t.String())
|
||||
modules[0].(*Module).sanitize.SetSanitizer(t, true)
|
||||
modules[0].(*Module).sanitize.Properties.InData = true
|
||||
} else {
|
||||
modules := mctx.CreateVariations("", t.String())
|
||||
modules[0].(*Module).sanitize.SetSanitizer(t, false)
|
||||
modules[1].(*Module).sanitize.SetSanitizer(t, true)
|
||||
modules[1].(*Module).appendVariantName("_" + t.String())
|
||||
modules[0].(*Module).sanitize.Properties.SanitizeDep = false
|
||||
modules[1].(*Module).sanitize.Properties.SanitizeDep = false
|
||||
modules[0].(*Module).Properties.HideFromMake = true
|
||||
}
|
||||
}
|
||||
c.sanitize.Properties.SanitizeDep = false
|
||||
|
Reference in New Issue
Block a user