Support DCLA
Bug: 240424572 Test: Manual tests: 1. m --dev-mode-staging com.android.adbd com.android.media.swcodec. 2. verify the DCLA libs from the two apexes have the same size and sha1sum, and also match the libs in bazel-out. 3. empty the DCLA libs list in allowlist.go and repeat step 1 4. repeat step 2 and verify the opposite result 5. build git_master: mainline_modules_bundles-userdebug in ABTD with the cl, then follow go/build-sideload-dcla-locally to download the adbd and swcodec aab files, run the DCLA trimming workflow locally, and verify the symlinks in the two trimmed apexes are identical and also match the lib path in the DCLA apex that was created by the workflow. Change-Id: Ib2f8a29126a54829c0e10eba17b256a79930fd70
This commit is contained in:
57
cc/cc.go
57
cc/cc.go
@@ -1905,10 +1905,29 @@ func (c *Module) IsMixedBuildSupported(ctx android.BaseModuleContext) bool {
|
||||
}
|
||||
|
||||
// TODO(b/261058727): Remove this (enable mixed 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
|
||||
// Currently we can only support ubsan when minimum runtime is used.
|
||||
return c.bazelHandler != nil && (!isUbsanEnabled(c) || c.MinimalRuntimeNeeded())
|
||||
}
|
||||
|
||||
func isUbsanEnabled(c *Module) bool {
|
||||
if c.sanitize == nil {
|
||||
return false
|
||||
}
|
||||
sanitizeProps := &c.sanitize.Properties.SanitizeMutated
|
||||
return Bool(sanitizeProps.Integer_overflow) || len(sanitizeProps.Misc_undefined) > 0
|
||||
}
|
||||
|
||||
func GetApexConfigKey(ctx android.BaseModuleContext) *android.ApexConfigKey {
|
||||
apexInfo := ctx.Provider(android.ApexInfoProvider).(android.ApexInfo)
|
||||
if !apexInfo.IsForPlatform() {
|
||||
apexKey := android.ApexConfigKey{
|
||||
WithinApex: true,
|
||||
ApexSdkVersion: findApexSdkVersion(ctx, apexInfo).String(),
|
||||
}
|
||||
return &apexKey
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (c *Module) ProcessBazelQueryResponse(ctx android.ModuleContext) {
|
||||
@@ -2841,6 +2860,23 @@ func checkDoubleLoadableLibraries(ctx android.TopDownMutatorContext) {
|
||||
}
|
||||
}
|
||||
|
||||
func findApexSdkVersion(ctx android.BaseModuleContext, apexInfo android.ApexInfo) android.ApiLevel {
|
||||
// For the dependency from platform to apex, use the latest stubs
|
||||
apexSdkVersion := android.FutureApiLevel
|
||||
if !apexInfo.IsForPlatform() {
|
||||
apexSdkVersion = apexInfo.MinSdkVersion
|
||||
}
|
||||
|
||||
if android.InList("hwaddress", ctx.Config().SanitizeDevice()) {
|
||||
// In hwasan build, we override apexSdkVersion to the FutureApiLevel(10000)
|
||||
// so that even Q(29/Android10) apexes could use the dynamic unwinder by linking the newer stubs(e.g libc(R+)).
|
||||
// (b/144430859)
|
||||
apexSdkVersion = android.FutureApiLevel
|
||||
}
|
||||
|
||||
return apexSdkVersion
|
||||
}
|
||||
|
||||
// Convert dependencies to paths. Returns a PathDeps containing paths
|
||||
func (c *Module) depsToPaths(ctx android.ModuleContext) PathDeps {
|
||||
var depPaths PathDeps
|
||||
@@ -2856,19 +2892,8 @@ func (c *Module) depsToPaths(ctx android.ModuleContext) PathDeps {
|
||||
depPaths.ReexportedGeneratedHeaders = append(depPaths.ReexportedGeneratedHeaders, exporter.GeneratedHeaders...)
|
||||
}
|
||||
|
||||
// For the dependency from platform to apex, use the latest stubs
|
||||
c.apexSdkVersion = android.FutureApiLevel
|
||||
apexInfo := ctx.Provider(android.ApexInfoProvider).(android.ApexInfo)
|
||||
if !apexInfo.IsForPlatform() {
|
||||
c.apexSdkVersion = apexInfo.MinSdkVersion
|
||||
}
|
||||
|
||||
if android.InList("hwaddress", ctx.Config().SanitizeDevice()) {
|
||||
// In hwasan build, we override apexSdkVersion to the FutureApiLevel(10000)
|
||||
// so that even Q(29/Android10) apexes could use the dynamic unwinder by linking the newer stubs(e.g libc(R+)).
|
||||
// (b/144430859)
|
||||
c.apexSdkVersion = android.FutureApiLevel
|
||||
}
|
||||
c.apexSdkVersion = findApexSdkVersion(ctx, apexInfo)
|
||||
|
||||
ctx.VisitDirectDeps(func(dep android.Module) {
|
||||
depName := ctx.OtherModuleName(dep)
|
||||
|
Reference in New Issue
Block a user