diff options
-rw-r--r-- | android/config.go | 7 | ||||
-rw-r--r-- | android/variable.go | 2 | ||||
-rw-r--r-- | cc/config/arm64_device.go | 11 | ||||
-rw-r--r-- | cc/config/arm_device.go | 7 |
4 files changed, 23 insertions, 4 deletions
diff --git a/android/config.go b/android/config.go index ba95c5a20..8ac0c8311 100644 --- a/android/config.go +++ b/android/config.go @@ -93,6 +93,13 @@ func (c Config) PrimaryBuilderInvocations() []bootstrap.PrimaryBuilderInvocation return []bootstrap.PrimaryBuilderInvocation{} } +// 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 373891ae4..4bed08ad8 100644 --- a/android/variable.go +++ b/android/variable.go @@ -210,6 +210,7 @@ type productVariables struct { DeviceVndkVersion *string `json:",omitempty"` DeviceCurrentApiLevelForVendorModules *string `json:",omitempty"` DeviceSystemSdkVersions []string `json:",omitempty"` + DeviceMaxPageSizeSupported *string `json:",omitempty"` RecoverySnapshotVersion *string `json:",omitempty"` @@ -480,6 +481,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 66087e6f0..5dcfdafa1 100644 --- a/cc/config/arm64_device.go +++ b/cc/config/arm64_device.go @@ -48,8 +48,7 @@ var ( "-Wl,-z,separate-code", } - arm64Lldflags = append(arm64Ldflags, - "-Wl,-z,max-page-size=4096") + arm64Lldflags = arm64Ldflags arm64Cppflags = []string{} @@ -97,7 +96,13 @@ func init() { "prebuilts/gcc/${HostPrebuiltTag}/aarch64/aarch64-linux-android-${arm64GccVersion}") 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 d702c6145..1adb477c2 100644 --- a/cc/config/arm_device.go +++ b/cc/config/arm_device.go @@ -181,7 +181,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) |