Merge "bp2build conversion for Sanitize.Integer_overflow"
This commit is contained in:
@@ -341,7 +341,7 @@ type baseAttributes struct {
|
||||
compilerAttributes
|
||||
linkerAttributes
|
||||
|
||||
// A combination of compilerAttributes.features and linkerAttributes.features
|
||||
// A combination of compilerAttributes.features and linkerAttributes.features, as well as sanitizer features
|
||||
features bazel.StringListAttribute
|
||||
protoDependency *bazel.LabelAttribute
|
||||
aidlDependency *bazel.LabelAttribute
|
||||
@@ -781,7 +781,7 @@ func bp2BuildParseBaseProps(ctx android.Bp2buildMutatorContext, module *Module)
|
||||
(&linkerAttrs).wholeArchiveDeps.Add(bp2buildCcSysprop(ctx, module.Name(), module.Properties.Min_sdk_version, compilerAttrs.syspropSrcs))
|
||||
}
|
||||
|
||||
features := compilerAttrs.features.Clone().Append(linkerAttrs.features)
|
||||
features := compilerAttrs.features.Clone().Append(linkerAttrs.features).Append(bp2buildSanitizerFeatures(ctx, module))
|
||||
features.DeduplicateAxesFromBase()
|
||||
|
||||
return baseAttributes{
|
||||
@@ -1364,3 +1364,20 @@ func bp2buildBinaryLinkerProps(ctx android.BazelConversionPathContext, m *Module
|
||||
|
||||
return attrs
|
||||
}
|
||||
|
||||
func bp2buildSanitizerFeatures(ctx android.BazelConversionPathContext, m *Module) bazel.StringListAttribute {
|
||||
sanitizerFeatures := bazel.StringListAttribute{}
|
||||
bp2BuildPropParseHelper(ctx, m, &SanitizeProperties{}, func(axis bazel.ConfigurationAxis, config string, props interface{}) {
|
||||
var features []string
|
||||
if sanitizerProps, ok := props.(*SanitizeProperties); ok {
|
||||
if sanitizerProps.Sanitize.Integer_overflow != nil && *sanitizerProps.Sanitize.Integer_overflow {
|
||||
features = append(features, "ubsan_integer_overflow")
|
||||
}
|
||||
for _, sanitizer := range sanitizerProps.Sanitize.Misc_undefined {
|
||||
features = append(features, "ubsan_"+sanitizer)
|
||||
}
|
||||
sanitizerFeatures.SetSelectValue(axis, config, features)
|
||||
}
|
||||
})
|
||||
return sanitizerFeatures
|
||||
}
|
||||
|
6
cc/cc.go
6
cc/cc.go
@@ -1859,7 +1859,11 @@ func (c *Module) QueueBazelCall(ctx android.BaseModuleContext) {
|
||||
}
|
||||
|
||||
func (c *Module) IsMixedBuildSupported(ctx android.BaseModuleContext) bool {
|
||||
return c.bazelHandler != nil
|
||||
// TODO(b/261058727): Remove this (enable mised builds for modules with UBSan)
|
||||
ubsanEnabled := c.sanitize != nil &&
|
||||
((c.sanitize.Properties.Sanitize.Integer_overflow != nil && *c.sanitize.Properties.Sanitize.Integer_overflow) ||
|
||||
c.sanitize.Properties.Sanitize.Misc_undefined != nil)
|
||||
return c.bazelHandler != nil && !ubsanEnabled
|
||||
}
|
||||
|
||||
func (c *Module) ProcessBazelQueryResponse(ctx android.ModuleContext) {
|
||||
|
Reference in New Issue
Block a user