Add default_shared_libs property
Building against a locally-built libc besides bionic requires setting
system_shared_libs to avoid circular dependencies, but modules all
over the tree assume that system_shared_libs only affects modules
building against bionic. Add a new default_shared_libs property
that applies to all modules, which will generally be set in
arch-specific clauses to only affect the desired set of modules.
Bug: 190084016
Test: m checkbuild
Change-Id: Ia2349d84c70e503916f90a5d2702e135248f73df
diff --git a/cc/library_sdk_member.go b/cc/library_sdk_member.go
index 9010a1a..9ad2742 100644
--- a/cc/library_sdk_member.go
+++ b/cc/library_sdk_member.go
@@ -258,6 +258,12 @@
outputProperties.AddPropertyWithTag("system_shared_libs", libInfo.SystemSharedLibs, builder.SdkMemberReferencePropertyTag(false))
}
+ // SystemSharedLibs needs to be propagated if it's a list, even if it's empty,
+ // so check for non-nil instead of nonzero length.
+ if libInfo.DefaultSharedLibs != nil {
+ outputProperties.AddPropertyWithTag("default_shared_libs", libInfo.DefaultSharedLibs, builder.SdkMemberReferencePropertyTag(false))
+ }
+
// Map from property name to the include dirs to add to the prebuilt module in the snapshot.
includeDirs := make(map[string][]string)
@@ -387,6 +393,12 @@
// This field is exported as its contents may not be arch specific.
SystemSharedLibs []string `android:"arch_variant"`
+ // The set of default shared libraries. Note nil and [] are semantically
+ // distinct - see BaseLinkerProperties.Default_shared_libs.
+ //
+ // This field is exported as its contents may not be arch specific.
+ DefaultSharedLibs []string `android:"arch_variant"`
+
// The specific stubs version for the lib variant, or empty string if stubs
// are not in use.
//
@@ -462,6 +474,7 @@
}
}
p.SystemSharedLibs = specifiedDeps.systemSharedLibs
+ p.DefaultSharedLibs = specifiedDeps.defaultSharedLibs
}
p.ExportedGeneratedHeaders = exportedInfo.GeneratedHeaders