Shard arch property structs
Arch property struct types are created at runtime. Go has a limit
of 2**16 bytes for the name of a type, and the type of a struct
created at runtime is a string containing all the names and types
of its fields. To avoid going over the limit, split the runtime
created structs into multiple shards.
Also undo MoreBaseLinkerProperties now that it is no longer
required.
Bug: 80437643
Test: m checkbuild
Test: no change to out/soong/build.ninja
Change-Id: I035b20332ec63f3d4b1696855c5b0b0a810597b7
diff --git a/cc/linker.go b/cc/linker.go
index a1593ee..3053609 100644
--- a/cc/linker.go
+++ b/cc/linker.go
@@ -118,6 +118,9 @@
// list of runtime libs that should not be installed along with the vendor
// variant of the C/C++ module.
Exclude_runtime_libs []string
+
+ // version script for this vendor variant
+ Version_script *string `android:"arch_variant"`
}
Recovery struct {
// list of shared libs that only should be used to build the recovery
@@ -140,23 +143,12 @@
// make android::build:GetBuildNumber() available containing the build ID.
Use_version_lib *bool `android:"arch_variant"`
-}
-// TODO(http://b/80437643): BaseLinkerProperties is getting too big,
-// more than 2^16 bytes. New properties are defined in MoreBaseLinkerProperties.
-type MoreBaseLinkerProperties struct {
// Generate compact dynamic relocation table, default true.
Pack_relocations *bool `android:"arch_variant"`
// local file name to pass to the linker as --version_script
Version_script *string `android:"arch_variant"`
-
- Target struct {
- Vendor struct {
- // version script for this vendor variant
- Version_script *string `android:"arch_variant"`
- }
- }
}
func NewBaseLinker(sanitize *sanitize) *baseLinker {
@@ -166,7 +158,6 @@
// baseLinker provides support for shared_libs, static_libs, and whole_static_libs properties
type baseLinker struct {
Properties BaseLinkerProperties
- MoreProperties MoreBaseLinkerProperties
dynamicProperties struct {
RunPaths []string `blueprint:"mutated"`
BuildStubs bool `blueprint:"mutated"`
@@ -188,7 +179,7 @@
}
func (linker *baseLinker) linkerProps() []interface{} {
- return []interface{}{&linker.Properties, &linker.MoreProperties, &linker.dynamicProperties}
+ return []interface{}{&linker.Properties, &linker.dynamicProperties}
}
func (linker *baseLinker) linkerDeps(ctx DepsContext, deps Deps) Deps {
@@ -283,9 +274,9 @@
// Version_script is not needed when linking stubs lib where the version
// script is created from the symbol map file.
if !linker.dynamicProperties.BuildStubs {
- android.ExtractSourceDeps(ctx, linker.MoreProperties.Version_script)
+ android.ExtractSourceDeps(ctx, linker.Properties.Version_script)
android.ExtractSourceDeps(ctx,
- linker.MoreProperties.Target.Vendor.Version_script)
+ linker.Properties.Target.Vendor.Version_script)
}
return deps
@@ -319,7 +310,7 @@
if linker.useClangLld(ctx) {
flags.LdFlags = append(flags.LdFlags, fmt.Sprintf("${config.%sGlobalLldflags}", hod))
- if !BoolDefault(linker.MoreProperties.Pack_relocations, true) {
+ if !BoolDefault(linker.Properties.Pack_relocations, true) {
flags.LdFlags = append(flags.LdFlags, "-Wl,--pack-dyn-relocs=none")
}
} else {
@@ -394,11 +385,11 @@
// script is created from the symbol map file.
if !linker.dynamicProperties.BuildStubs {
versionScript := ctx.ExpandOptionalSource(
- linker.MoreProperties.Version_script, "version_script")
+ linker.Properties.Version_script, "version_script")
- if ctx.useVndk() && linker.MoreProperties.Target.Vendor.Version_script != nil {
+ if ctx.useVndk() && linker.Properties.Target.Vendor.Version_script != nil {
versionScript = ctx.ExpandOptionalSource(
- linker.MoreProperties.Target.Vendor.Version_script,
+ linker.Properties.Target.Vendor.Version_script,
"target.vendor.version_script")
}