Only allowlist cfi enabled modules for apex variant.
Bug: 286224058 Test: lunch aosp_bramble-userdebug && m --skip-soong-tests nothing --bazel-mode-staging Change-Id: Ida3287ee718dc868a46b625f82c352029734a724
This commit is contained in:
17
cc/cc.go
17
cc/cc.go
@@ -1913,14 +1913,14 @@ func (c *Module) QueueBazelCall(ctx android.BaseModuleContext) {
|
|||||||
// IsMixedBuildSupported returns true if the module should be analyzed by Bazel
|
// IsMixedBuildSupported returns true if the module should be analyzed by Bazel
|
||||||
// in any of the --bazel-mode(s).
|
// in any of the --bazel-mode(s).
|
||||||
func (c *Module) IsMixedBuildSupported(ctx android.BaseModuleContext) bool {
|
func (c *Module) IsMixedBuildSupported(ctx android.BaseModuleContext) bool {
|
||||||
if !allEnabledSanitizersSupportedByBazel(c) {
|
if !allEnabledSanitizersSupportedByBazel(ctx, c) {
|
||||||
//TODO(b/278772861) support sanitizers in Bazel rules
|
//TODO(b/278772861) support sanitizers in Bazel rules
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
return c.bazelHandler != nil
|
return c.bazelHandler != nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func allEnabledSanitizersSupportedByBazel(c *Module) bool {
|
func allEnabledSanitizersSupportedByBazel(ctx android.BaseModuleContext, c *Module) bool {
|
||||||
if c.sanitize == nil {
|
if c.sanitize == nil {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
@@ -1943,12 +1943,17 @@ func allEnabledSanitizersSupportedByBazel(c *Module) bool {
|
|||||||
// TODO(b/261058727): enable mixed builds for all modules with UBSan
|
// TODO(b/261058727): enable mixed builds for all modules with UBSan
|
||||||
// Currently we can only support ubsan when minimum runtime is used.
|
// Currently we can only support ubsan when minimum runtime is used.
|
||||||
ubsanEnabled := Bool(sanitizeProps.Integer_overflow) || len(sanitizeProps.Misc_undefined) > 0
|
ubsanEnabled := Bool(sanitizeProps.Integer_overflow) || len(sanitizeProps.Misc_undefined) > 0
|
||||||
if ubsanEnabled && !c.MinimalRuntimeNeeded() {
|
if !ubsanEnabled || c.MinimalRuntimeNeeded() {
|
||||||
return false
|
continue
|
||||||
}
|
}
|
||||||
} else if san == cfi {
|
} else if san == cfi {
|
||||||
continue
|
apexInfo := ctx.Provider(android.ApexInfoProvider).(android.ApexInfo)
|
||||||
} else if c.sanitize.isSanitizerEnabled(san) {
|
// Only allow cfi if this is an apex variant
|
||||||
|
if !apexInfo.IsForPlatform() {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if c.sanitize.isSanitizerEnabled(san) {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user