Merge changes from topic "sharedlib_in_recovery"
* changes:
Recovery variants are built with -D__ANDROID_RECOVERY__
Recovery partition has same layout as system
diff --git a/cc/builder.go b/cc/builder.go
index bc3652e..51d3195 100644
--- a/cc/builder.go
+++ b/cc/builder.go
@@ -726,11 +726,14 @@
baseName, exportedHeaderFlags string, isVndkExt bool) android.OptionalPath {
outputFile := android.PathForModuleOut(ctx, baseName+".abidiff")
-
+ libName := strings.TrimSuffix(baseName, filepath.Ext(baseName))
localAbiCheckAllowFlags := append([]string(nil), abiCheckAllowFlags...)
if exportedHeaderFlags == "" {
localAbiCheckAllowFlags = append(localAbiCheckAllowFlags, "-advice-only")
}
+ if inList(libName, llndkLibraries) {
+ localAbiCheckAllowFlags = append(localAbiCheckAllowFlags, "-consider-opaque-types-different")
+ }
if isVndkExt {
localAbiCheckAllowFlags = append(localAbiCheckAllowFlags, "-allow-extensions")
}
@@ -743,7 +746,7 @@
Implicit: referenceDump,
Args: map[string]string{
"referenceDump": referenceDump.String(),
- "libName": baseName[0:(len(baseName) - len(filepath.Ext(baseName)))],
+ "libName": libName,
"arch": ctx.Arch().ArchType.Name,
"allowFlags": strings.Join(localAbiCheckAllowFlags, " "),
},
diff --git a/cc/cc.go b/cc/cc.go
index 36b2f95..6438bcd 100644
--- a/cc/cc.go
+++ b/cc/cc.go
@@ -571,7 +571,7 @@
isVariantOnProductionDevice = sanitize.isVariantOnProductionDevice()
}
vendorAvailable := Bool(ctx.mod.VendorProperties.Vendor_available)
- return !skipAbiChecks && isVariantOnProductionDevice && ctx.ctx.Device() && ((ctx.useVndk() && ctx.isVndk() && vendorAvailable) || inList(ctx.baseModuleName(), llndkLibraries))
+ return !skipAbiChecks && isVariantOnProductionDevice && ctx.ctx.Device() && ((ctx.useVndk() && ctx.isVndk() && (vendorAvailable || ctx.isVndkExt())) || inList(ctx.baseModuleName(), llndkLibraries))
}
func (ctx *moduleContextImpl) selectedStl() string {
diff --git a/cc/cmakelists.go b/cc/cmakelists.go
index c25578e..a2f46cd 100644
--- a/cc/cmakelists.go
+++ b/cc/cmakelists.go
@@ -62,10 +62,14 @@
outputDebugInfo = (getEnvVariable(envVariableGenerateDebugInfo, ctx) == envVariableTrue)
+ // Track which projects have already had CMakeLists.txt generated to keep the first
+ // variant for each project.
+ seenProjects := map[string]bool{}
+
ctx.VisitAllModules(func(module android.Module) {
if ccModule, ok := module.(*Module); ok {
if compiledModule, ok := ccModule.compiler.(CompiledInterface); ok {
- generateCLionProject(compiledModule, ctx, ccModule)
+ generateCLionProject(compiledModule, ctx, ccModule, seenProjects)
}
}
})
@@ -114,14 +118,22 @@
return nil
}
-func generateCLionProject(compiledModule CompiledInterface, ctx android.SingletonContext, ccModule *Module) {
+func generateCLionProject(compiledModule CompiledInterface, ctx android.SingletonContext, ccModule *Module,
+ seenProjects map[string]bool) {
srcs := compiledModule.Srcs()
if len(srcs) == 0 {
return
}
- // Ensure the directory hosting the cmakelists.txt exists
+ // Only write CMakeLists.txt for the first variant of each architecture of each module
clionproject_location := getCMakeListsForModule(ccModule, ctx)
+ if seenProjects[clionproject_location] {
+ return
+ }
+
+ seenProjects[clionproject_location] = true
+
+ // Ensure the directory hosting the cmakelists.txt exists
projectDir := path.Dir(clionproject_location)
os.MkdirAll(projectDir, os.ModePerm)
diff --git a/cc/config/global.go b/cc/config/global.go
index c734c2e..dee7640 100644
--- a/cc/config/global.go
+++ b/cc/config/global.go
@@ -89,6 +89,9 @@
deviceGlobalLldflags = append(ClangFilterUnknownLldflags(deviceGlobalLdflags),
[]string{
+ // TODO(b/109657296): needs --no-rosegment until Android
+ // stack unwinder can handle the read-only segment.
+ "-Wl,--no-rosegment",
"-Wl,--pack-dyn-relocs=android",
"-fuse-ld=lld",
}...)
diff --git a/cc/vndk_prebuilt.go b/cc/vndk_prebuilt.go
index 9c9545d..849bb3f 100644
--- a/cc/vndk_prebuilt.go
+++ b/cc/vndk_prebuilt.go
@@ -21,7 +21,8 @@
)
var (
- vndkSuffix = ".vndk."
+ vndkSuffix = ".vndk."
+ binder32Suffix = ".binder32"
)
// Creates vndk prebuilts that include the VNDK version.
@@ -53,6 +54,10 @@
// Target arch name of the snapshot (e.g. 'arm64' for variant 'aosp_arm64_ab')
Target_arch *string
+ // If the prebuilt snapshot lib is built with 32 bit binder, this must be set to true.
+ // The lib with 64 bit binder does not need to set this property.
+ Binder32bit *bool
+
// Prebuilt files for each arch.
Srcs []string `android:"arch_variant"`
}
@@ -67,10 +72,14 @@
}
func (p *vndkPrebuiltLibraryDecorator) NameSuffix() string {
+ suffix := p.version()
if p.arch() != "" {
- return vndkSuffix + p.version() + "." + p.arch()
+ suffix += "." + p.arch()
}
- return vndkSuffix + p.version()
+ if Bool(p.properties.Binder32bit) {
+ suffix += binder32Suffix
+ }
+ return vndkSuffix + suffix
}
func (p *vndkPrebuiltLibraryDecorator) version() string {
@@ -81,6 +90,13 @@
return String(p.properties.Target_arch)
}
+func (p *vndkPrebuiltLibraryDecorator) binderBit() string {
+ if Bool(p.properties.Binder32bit) {
+ return "32"
+ }
+ return "64"
+}
+
func (p *vndkPrebuiltLibraryDecorator) linkerFlags(ctx ModuleContext, flags Flags) Flags {
p.libraryDecorator.libName = strings.TrimSuffix(ctx.ModuleName(), p.NameSuffix())
return p.libraryDecorator.linkerFlags(ctx, flags)
@@ -114,6 +130,9 @@
if len(arches) == 0 || arches[0].ArchType.String() != p.arch() {
return
}
+ if ctx.DeviceConfig().BinderBitness() != p.binderBit() {
+ return
+ }
if p.shared() {
if ctx.isVndkSp() {
p.baseInstaller.subDir = "vndk-sp-" + p.version()