Loading cc/linkable.go +6 −6 Original line number Diff line number Diff line Loading @@ -22,16 +22,16 @@ type PlatformSanitizeable interface { // than left undefined. IsSanitizerExplicitlyDisabled(t SanitizerType) bool // SanitizeDep returns the value of the SanitizeDep flag, which is set if a module is a dependency of a // sanitized module. SanitizeDep() bool // SanitizeDep returns true if the module is statically linked into another that is sanitized // with the given sanitizer. SanitizeDep(t SanitizerType) bool // SetSanitizeDep marks a module as a static dependency of another module to be sanitized. SetSanitizeDep(t SanitizerType) // SetSanitizer enables or disables the specified sanitizer type if it's supported, otherwise this should panic. SetSanitizer(t SanitizerType, b bool) // SetSanitizerDep returns true if the module is statically linked. SetSanitizeDep(b bool) // StaticallyLinked returns true if the module is statically linked. StaticallyLinked() bool Loading cc/sanitize.go +17 −15 Original line number Diff line number Diff line Loading @@ -276,7 +276,7 @@ type SanitizeUserProps struct { type SanitizeProperties struct { Sanitize SanitizeUserProps `android:"arch_variant"` SanitizerEnabled bool `blueprint:"mutated"` SanitizeDep bool `blueprint:"mutated"` SanitizeDepTypes []SanitizerType `blueprint:"mutated"` MinimalRuntimeDep bool `blueprint:"mutated"` BuiltinsDep bool `blueprint:"mutated"` UbsanRuntimeDep bool `blueprint:"mutated"` Loading Loading @@ -944,7 +944,7 @@ func sanitizerDepsMutator(t SanitizerType) func(android.TopDownMutatorContext) { // determine defaultVariation in sanitizerMutator below. // Instead, just mark SanitizeDep to forcefully create cfi variant. enabled = true c.SetSanitizeDep(true) c.SetSanitizeDep(t) } if enabled { isSanitizableDependencyTag := c.SanitizableDepTagChecker() Loading @@ -959,10 +959,10 @@ func sanitizerDepsMutator(t SanitizerType) func(android.TopDownMutatorContext) { if d.StaticallyLinked() && d.SanitizerSupported(t) { // Rust does not support some of these sanitizers, so we need to check if it's // supported before setting this true. d.SetSanitizeDep(true) d.SetSanitizeDep(t) } } else { d.SetSanitizeDep(true) d.SetSanitizeDep(t) } } return true Loading @@ -978,7 +978,7 @@ func sanitizerDepsMutator(t SanitizerType) func(android.TopDownMutatorContext) { c.SanitizePropDefined() && !c.SanitizeNever() && !c.IsSanitizerExplicitlyDisabled(t) { c.SetSanitizeDep(true) c.SetSanitizeDep(t) } }) } Loading Loading @@ -1315,8 +1315,14 @@ func (c *Module) IsSanitizerEnabled(t SanitizerType) bool { return c.sanitize.isSanitizerEnabled(t) } func (c *Module) SanitizeDep() bool { return c.sanitize.Properties.SanitizeDep func (c *Module) SanitizeDep(t SanitizerType) bool { for _, e := range c.sanitize.Properties.SanitizeDepTypes { if t == e { return true } } return false } func (c *Module) StaticallyLinked() bool { Loading @@ -1335,9 +1341,9 @@ func (c *Module) SetSanitizer(t SanitizerType, b bool) { } } func (c *Module) SetSanitizeDep(b bool) { if c.sanitize != nil { c.sanitize.Properties.SanitizeDep = b func (c *Module) SetSanitizeDep(t SanitizerType) { if !c.SanitizeDep(t) { c.sanitize.Properties.SanitizeDepTypes = append(c.sanitize.Properties.SanitizeDepTypes, t) } } Loading @@ -1354,7 +1360,7 @@ func sanitizerMutator(t SanitizerType) func(android.BottomUpMutatorContext) { if c.Binary() && c.IsSanitizerEnabled(t) { modules := mctx.CreateVariations(t.variationName()) modules[0].(PlatformSanitizeable).SetSanitizer(t, true) } else if c.IsSanitizerEnabled(t) || c.SanitizeDep() { } else if c.IsSanitizerEnabled(t) || c.SanitizeDep(t) { isSanitizerEnabled := c.IsSanitizerEnabled(t) if c.StaticallyLinked() || c.Header() || t == Fuzzer { // Static and header libs are split into non-sanitized and sanitized variants. Loading @@ -1376,8 +1382,6 @@ func sanitizerMutator(t SanitizerType) func(android.BottomUpMutatorContext) { modules := mctx.CreateVariations("", t.variationName()) modules[0].(PlatformSanitizeable).SetSanitizer(t, false) modules[1].(PlatformSanitizeable).SetSanitizer(t, true) modules[0].(PlatformSanitizeable).SetSanitizeDep(false) modules[1].(PlatformSanitizeable).SetSanitizeDep(false) if mctx.Device() && t.incompatibleWithCfi() && cfiSupported { // TODO: Make sure that cfi mutator runs "after" any of the sanitizers that Loading Loading @@ -1410,7 +1414,6 @@ func sanitizerMutator(t SanitizerType) func(android.BottomUpMutatorContext) { // Shared libs are not split. Only the sanitized variant is created. modules := mctx.CreateVariations(t.variationName()) modules[0].(PlatformSanitizeable).SetSanitizer(t, true) modules[0].(PlatformSanitizeable).SetSanitizeDep(false) // locate the asan libraries under /data/asan if mctx.Device() && t == Asan && isSanitizerEnabled { Loading @@ -1424,7 +1427,6 @@ func sanitizerMutator(t SanitizerType) func(android.BottomUpMutatorContext) { } } } c.SetSanitizeDep(false) } else if sanitizeable, ok := mctx.Module().(Sanitizeable); ok && sanitizeable.IsSanitizerEnabled(mctx, t.name()) { // APEX and Java fuzz modules fall here sanitizeable.AddSanitizerDependencies(mctx, t.name()) Loading rust/sanitize.go +14 −6 Original line number Diff line number Diff line Loading @@ -50,7 +50,7 @@ type SanitizeProperties struct { } } SanitizerEnabled bool `blueprint:"mutated"` SanitizeDep bool `blueprint:"mutated"` SanitizeDepTypes []cc.SanitizerType `blueprint:"mutated"` // Used when we need to place libraries in their own directory, such as ASAN. InSanitizerDir bool `blueprint:"mutated"` Loading Loading @@ -444,8 +444,14 @@ func (mod *Module) IsSanitizerExplicitlyDisabled(t cc.SanitizerType) bool { return mod.sanitize.isSanitizerExplicitlyDisabled(t) } func (mod *Module) SanitizeDep() bool { return mod.sanitize.Properties.SanitizeDep func (mod *Module) SanitizeDep(t cc.SanitizerType) bool { for _, e := range mod.sanitize.Properties.SanitizeDepTypes { if t == e { return true } } return false } func (mod *Module) SetSanitizer(t cc.SanitizerType, b bool) { Loading @@ -454,8 +460,10 @@ func (mod *Module) SetSanitizer(t cc.SanitizerType, b bool) { } } func (mod *Module) SetSanitizeDep(b bool) { mod.sanitize.Properties.SanitizeDep = b func (c *Module) SetSanitizeDep(t cc.SanitizerType) { if !c.SanitizeDep(t) { c.sanitize.Properties.SanitizeDepTypes = append(c.sanitize.Properties.SanitizeDepTypes, t) } } func (mod *Module) StaticallyLinked() bool { Loading Loading
cc/linkable.go +6 −6 Original line number Diff line number Diff line Loading @@ -22,16 +22,16 @@ type PlatformSanitizeable interface { // than left undefined. IsSanitizerExplicitlyDisabled(t SanitizerType) bool // SanitizeDep returns the value of the SanitizeDep flag, which is set if a module is a dependency of a // sanitized module. SanitizeDep() bool // SanitizeDep returns true if the module is statically linked into another that is sanitized // with the given sanitizer. SanitizeDep(t SanitizerType) bool // SetSanitizeDep marks a module as a static dependency of another module to be sanitized. SetSanitizeDep(t SanitizerType) // SetSanitizer enables or disables the specified sanitizer type if it's supported, otherwise this should panic. SetSanitizer(t SanitizerType, b bool) // SetSanitizerDep returns true if the module is statically linked. SetSanitizeDep(b bool) // StaticallyLinked returns true if the module is statically linked. StaticallyLinked() bool Loading
cc/sanitize.go +17 −15 Original line number Diff line number Diff line Loading @@ -276,7 +276,7 @@ type SanitizeUserProps struct { type SanitizeProperties struct { Sanitize SanitizeUserProps `android:"arch_variant"` SanitizerEnabled bool `blueprint:"mutated"` SanitizeDep bool `blueprint:"mutated"` SanitizeDepTypes []SanitizerType `blueprint:"mutated"` MinimalRuntimeDep bool `blueprint:"mutated"` BuiltinsDep bool `blueprint:"mutated"` UbsanRuntimeDep bool `blueprint:"mutated"` Loading Loading @@ -944,7 +944,7 @@ func sanitizerDepsMutator(t SanitizerType) func(android.TopDownMutatorContext) { // determine defaultVariation in sanitizerMutator below. // Instead, just mark SanitizeDep to forcefully create cfi variant. enabled = true c.SetSanitizeDep(true) c.SetSanitizeDep(t) } if enabled { isSanitizableDependencyTag := c.SanitizableDepTagChecker() Loading @@ -959,10 +959,10 @@ func sanitizerDepsMutator(t SanitizerType) func(android.TopDownMutatorContext) { if d.StaticallyLinked() && d.SanitizerSupported(t) { // Rust does not support some of these sanitizers, so we need to check if it's // supported before setting this true. d.SetSanitizeDep(true) d.SetSanitizeDep(t) } } else { d.SetSanitizeDep(true) d.SetSanitizeDep(t) } } return true Loading @@ -978,7 +978,7 @@ func sanitizerDepsMutator(t SanitizerType) func(android.TopDownMutatorContext) { c.SanitizePropDefined() && !c.SanitizeNever() && !c.IsSanitizerExplicitlyDisabled(t) { c.SetSanitizeDep(true) c.SetSanitizeDep(t) } }) } Loading Loading @@ -1315,8 +1315,14 @@ func (c *Module) IsSanitizerEnabled(t SanitizerType) bool { return c.sanitize.isSanitizerEnabled(t) } func (c *Module) SanitizeDep() bool { return c.sanitize.Properties.SanitizeDep func (c *Module) SanitizeDep(t SanitizerType) bool { for _, e := range c.sanitize.Properties.SanitizeDepTypes { if t == e { return true } } return false } func (c *Module) StaticallyLinked() bool { Loading @@ -1335,9 +1341,9 @@ func (c *Module) SetSanitizer(t SanitizerType, b bool) { } } func (c *Module) SetSanitizeDep(b bool) { if c.sanitize != nil { c.sanitize.Properties.SanitizeDep = b func (c *Module) SetSanitizeDep(t SanitizerType) { if !c.SanitizeDep(t) { c.sanitize.Properties.SanitizeDepTypes = append(c.sanitize.Properties.SanitizeDepTypes, t) } } Loading @@ -1354,7 +1360,7 @@ func sanitizerMutator(t SanitizerType) func(android.BottomUpMutatorContext) { if c.Binary() && c.IsSanitizerEnabled(t) { modules := mctx.CreateVariations(t.variationName()) modules[0].(PlatformSanitizeable).SetSanitizer(t, true) } else if c.IsSanitizerEnabled(t) || c.SanitizeDep() { } else if c.IsSanitizerEnabled(t) || c.SanitizeDep(t) { isSanitizerEnabled := c.IsSanitizerEnabled(t) if c.StaticallyLinked() || c.Header() || t == Fuzzer { // Static and header libs are split into non-sanitized and sanitized variants. Loading @@ -1376,8 +1382,6 @@ func sanitizerMutator(t SanitizerType) func(android.BottomUpMutatorContext) { modules := mctx.CreateVariations("", t.variationName()) modules[0].(PlatformSanitizeable).SetSanitizer(t, false) modules[1].(PlatformSanitizeable).SetSanitizer(t, true) modules[0].(PlatformSanitizeable).SetSanitizeDep(false) modules[1].(PlatformSanitizeable).SetSanitizeDep(false) if mctx.Device() && t.incompatibleWithCfi() && cfiSupported { // TODO: Make sure that cfi mutator runs "after" any of the sanitizers that Loading Loading @@ -1410,7 +1414,6 @@ func sanitizerMutator(t SanitizerType) func(android.BottomUpMutatorContext) { // Shared libs are not split. Only the sanitized variant is created. modules := mctx.CreateVariations(t.variationName()) modules[0].(PlatformSanitizeable).SetSanitizer(t, true) modules[0].(PlatformSanitizeable).SetSanitizeDep(false) // locate the asan libraries under /data/asan if mctx.Device() && t == Asan && isSanitizerEnabled { Loading @@ -1424,7 +1427,6 @@ func sanitizerMutator(t SanitizerType) func(android.BottomUpMutatorContext) { } } } c.SetSanitizeDep(false) } else if sanitizeable, ok := mctx.Module().(Sanitizeable); ok && sanitizeable.IsSanitizerEnabled(mctx, t.name()) { // APEX and Java fuzz modules fall here sanitizeable.AddSanitizerDependencies(mctx, t.name()) Loading
rust/sanitize.go +14 −6 Original line number Diff line number Diff line Loading @@ -50,7 +50,7 @@ type SanitizeProperties struct { } } SanitizerEnabled bool `blueprint:"mutated"` SanitizeDep bool `blueprint:"mutated"` SanitizeDepTypes []cc.SanitizerType `blueprint:"mutated"` // Used when we need to place libraries in their own directory, such as ASAN. InSanitizerDir bool `blueprint:"mutated"` Loading Loading @@ -444,8 +444,14 @@ func (mod *Module) IsSanitizerExplicitlyDisabled(t cc.SanitizerType) bool { return mod.sanitize.isSanitizerExplicitlyDisabled(t) } func (mod *Module) SanitizeDep() bool { return mod.sanitize.Properties.SanitizeDep func (mod *Module) SanitizeDep(t cc.SanitizerType) bool { for _, e := range mod.sanitize.Properties.SanitizeDepTypes { if t == e { return true } } return false } func (mod *Module) SetSanitizer(t cc.SanitizerType, b bool) { Loading @@ -454,8 +460,10 @@ func (mod *Module) SetSanitizer(t cc.SanitizerType, b bool) { } } func (mod *Module) SetSanitizeDep(b bool) { mod.sanitize.Properties.SanitizeDep = b func (c *Module) SetSanitizeDep(t cc.SanitizerType) { if !c.SanitizeDep(t) { c.sanitize.Properties.SanitizeDepTypes = append(c.sanitize.Properties.SanitizeDepTypes, t) } } func (mod *Module) StaticallyLinked() bool { Loading