summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--android/config.go7
-rw-r--r--android/variable.go2
-rw-r--r--cc/config/arm64_device.go11
-rw-r--r--cc/config/arm_device.go7
-rw-r--r--java/android_manifest.go4
-rw-r--r--java/app_test.go12
-rw-r--r--licenses/Android.bp5
7 files changed, 42 insertions, 6 deletions
diff --git a/android/config.go b/android/config.go
index 032172d6e..9920fe41b 100644
--- a/android/config.go
+++ b/android/config.go
@@ -174,6 +174,13 @@ func (c Config) RunningInsideUnitTest() bool {
return c.config.TestProductVariables != nil
}
+// MaxPageSizeSupported returns the max page size supported by the device. This
+// value will define the ELF segment alignment for binaries (executables and
+// shared libraries).
+func (c Config) MaxPageSizeSupported() string {
+ return String(c.config.productVariables.DeviceMaxPageSizeSupported)
+}
+
// A DeviceConfig object represents the configuration for a particular device
// being built. For now there will only be one of these, but in the future there
// may be multiple devices being built.
diff --git a/android/variable.go b/android/variable.go
index 249d53b07..d7152b367 100644
--- a/android/variable.go
+++ b/android/variable.go
@@ -218,6 +218,7 @@ type productVariables struct {
DeviceVndkVersion *string `json:",omitempty"`
DeviceCurrentApiLevelForVendorModules *string `json:",omitempty"`
DeviceSystemSdkVersions []string `json:",omitempty"`
+ DeviceMaxPageSizeSupported *string `json:",omitempty"`
RecoverySnapshotVersion *string `json:",omitempty"`
@@ -505,6 +506,7 @@ func (v *productVariables) SetDefaultConfig() {
DeviceSecondaryArchVariant: stringPtr("armv8-a"),
DeviceSecondaryCpuVariant: stringPtr("generic"),
DeviceSecondaryAbi: []string{"armeabi-v7a", "armeabi"},
+ DeviceMaxPageSizeSupported: stringPtr("4096"),
AAPTConfig: []string{"normal", "large", "xlarge", "hdpi", "xhdpi", "xxhdpi"},
AAPTPreferredConfig: stringPtr("xhdpi"),
diff --git a/cc/config/arm64_device.go b/cc/config/arm64_device.go
index 28f368205..ca2e05fc3 100644
--- a/cc/config/arm64_device.go
+++ b/cc/config/arm64_device.go
@@ -53,8 +53,7 @@ var (
"-Wl,-z,separate-code",
}
- arm64Lldflags = append(arm64Ldflags,
- "-Wl,-z,max-page-size=4096")
+ arm64Lldflags = arm64Ldflags
arm64Cppflags = []string{}
@@ -93,7 +92,13 @@ var (
func init() {
exportedVars.ExportStringListStaticVariable("Arm64Ldflags", arm64Ldflags)
- exportedVars.ExportStringListStaticVariable("Arm64Lldflags", arm64Lldflags)
+
+ exportedVars.ExportStringList("Arm64Lldflags", arm64Lldflags)
+ pctx.VariableFunc("Arm64Lldflags", func(ctx android.PackageVarContext) string {
+ maxPageSizeFlag := "-Wl,-z,max-page-size=" + ctx.Config().MaxPageSizeSupported()
+ flags := append(arm64Lldflags, maxPageSizeFlag)
+ return strings.Join(flags, " ")
+ })
exportedVars.ExportStringListStaticVariable("Arm64Cflags", arm64Cflags)
exportedVars.ExportStringListStaticVariable("Arm64Cppflags", arm64Cppflags)
diff --git a/cc/config/arm_device.go b/cc/config/arm_device.go
index 070455021..dec2b4552 100644
--- a/cc/config/arm_device.go
+++ b/cc/config/arm_device.go
@@ -185,7 +185,12 @@ func init() {
exportedVars.ExportString("ArmClangTriple", clangTriple)
exportedVars.ExportStringListStaticVariable("ArmLdflags", armLdflags)
- exportedVars.ExportStringListStaticVariable("ArmLldflags", armLldflags)
+ exportedVars.ExportStringList("ArmLldflags", armLldflags)
+ pctx.VariableFunc("ArmLldflags", func(ctx android.PackageVarContext) string {
+ maxPageSizeFlag := "-Wl,-z,max-page-size=" + ctx.Config().MaxPageSizeSupported()
+ flags := append(armLldflags, maxPageSizeFlag)
+ return strings.Join(flags, " ")
+ })
exportedVars.ExportStringListStaticVariable("ArmFixCortexA8LdFlags", armFixCortexA8LdFlags)
exportedVars.ExportStringListStaticVariable("ArmNoFixCortexA8LdFlags", armNoFixCortexA8LdFlags)
diff --git a/java/android_manifest.go b/java/android_manifest.go
index dbcf09830..f2ebfa6a2 100644
--- a/java/android_manifest.go
+++ b/java/android_manifest.go
@@ -63,9 +63,11 @@ func targetSdkVersionForManifestFixer(ctx android.ModuleContext, params Manifest
// 2. The module is run as part of MTS, and should be testable on stable branches
// Do not return 10000 if we are enforcing default targetSdkVersion and sdk has been finalised
func shouldReturnFinalOrFutureInt(ctx android.ModuleContext, targetSdkVersionLevel android.ApiLevel, enforceDefaultTargetSdkVersion bool) bool {
- if enforceDefaultTargetSdkVersion && ctx.Config().PlatformSdkFinal() {
+ // If this is a REL branch, do not return 10000
+ if ctx.Config().PlatformSdkFinal() {
return false
}
+ // If this a module targeting an unreleased SDK (MTS or unbundled builds), return 10000
return targetSdkVersionLevel.IsPreview() && (ctx.Config().UnbundledBuildApps() || includedInMts(ctx.Module()))
}
diff --git a/java/app_test.go b/java/app_test.go
index 561be684e..7e97b0fb1 100644
--- a/java/app_test.go
+++ b/java/app_test.go
@@ -3034,11 +3034,13 @@ func TestExportedProguardFlagFiles(t *testing.T) {
func TestTargetSdkVersionManifestFixer(t *testing.T) {
platform_sdk_codename := "Tiramisu"
+ platform_sdk_version := 33
testCases := []struct {
name string
targetSdkVersionInBp string
targetSdkVersionExpected string
unbundledBuild bool
+ platformSdkFinal bool
}{
{
name: "Non-Unbundled build: Android.bp has targetSdkVersion",
@@ -3075,6 +3077,12 @@ func TestTargetSdkVersionManifestFixer(t *testing.T) {
targetSdkVersionExpected: "10000",
unbundledBuild: true,
},
+ {
+ name: "Bundled build in REL branches",
+ targetSdkVersionExpected: "33",
+ unbundledBuild: false,
+ platformSdkFinal: true,
+ },
}
for _, testCase := range testCases {
targetSdkVersionTemplate := ""
@@ -3091,8 +3099,12 @@ func TestTargetSdkVersionManifestFixer(t *testing.T) {
fixture := android.GroupFixturePreparers(
prepareForJavaTest,
android.FixtureModifyProductVariables(func(variables android.FixtureProductVariables) {
+ if testCase.platformSdkFinal {
+ variables.Platform_sdk_final = proptools.BoolPtr(true)
+ }
// explicitly set platform_sdk_codename to make the test deterministic
variables.Platform_sdk_codename = &platform_sdk_codename
+ variables.Platform_sdk_version = &platform_sdk_version
variables.Platform_version_active_codenames = []string{platform_sdk_codename}
// create a non-empty list if unbundledBuild==true
if testCase.unbundledBuild {
diff --git a/licenses/Android.bp b/licenses/Android.bp
index 7267cf374..dee72ed42 100644
--- a/licenses/Android.bp
+++ b/licenses/Android.bp
@@ -923,7 +923,10 @@ license_kind {
license_kind {
name: "SPDX-license-identifier-Linux-syscall-note",
// expanding visibility requires approval from an OSPO lawyer or pcounsel
- visibility: ["//external/libbpf:__subpackages__"],
+ visibility: [
+ "//external/libbpf:__subpackages__",
+ "//prebuilts/vsdk:__subpackages__",
+ ],
conditions: ["permissive"],
url: "https://spdx.org/licenses/Linux-syscall-note.html",
}