summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Jooyung Han <jooyung@google.com> 2023-11-29 01:44:33 +0000
committer Gerrit Code Review <noreply-gerritcodereview@google.com> 2023-11-29 01:44:33 +0000
commit2648a99386f31daf51063fa12d20bce0c98ec00d (patch)
tree63d09b8491c3d1ee7b641a2f364e7751c8bdbd3b
parent7d813e0dba8ccdca0360f3dbb3ca28ff6db5b82b (diff)
parent9ffbe83028aba1dc737547f5c85819d188e31f2e (diff)
Merge "Add non_apex.exclude_shared_libs to cc" into main
-rw-r--r--cc/cc.go10
-rw-r--r--cc/linker.go9
2 files changed, 19 insertions, 0 deletions
diff --git a/cc/cc.go b/cc/cc.go
index e215438f2..a2cbb3622 100644
--- a/cc/cc.go
+++ b/cc/cc.go
@@ -141,6 +141,8 @@ type Deps struct {
// List of libs that need to be excluded for APEX variant
ExcludeLibsForApex []string
+ // List of libs that need to be excluded for non-APEX variant
+ ExcludeLibsForNonApex []string
}
// PathDeps is a struct containing file paths to dependencies of a module.
@@ -728,6 +730,8 @@ type libraryDependencyTag struct {
// Whether or not this dependency has to be followed for the apex variants
excludeInApex bool
+ // Whether or not this dependency has to be followed for the non-apex variants
+ excludeInNonApex bool
// If true, don't automatically export symbols from the static library into a shared library.
unexportedSymbols bool
@@ -2819,6 +2823,9 @@ func (c *Module) DepsMutator(actx android.BottomUpMutatorContext) {
if inList(lib, deps.ExcludeLibsForApex) {
depTag.excludeInApex = true
}
+ if inList(lib, deps.ExcludeLibsForNonApex) {
+ depTag.excludeInNonApex = true
+ }
name, version := StubsLibNameAndVersion(lib)
if apiLibraryName, ok := apiImportInfo.SharedLibs[name]; ok && !ctx.OtherModuleExists(name) {
@@ -3335,6 +3342,9 @@ func (c *Module) depsToPaths(ctx android.ModuleContext) PathDeps {
if !apexInfo.IsForPlatform() && libDepTag.excludeInApex {
return
}
+ if apexInfo.IsForPlatform() && libDepTag.excludeInNonApex {
+ return
+ }
depExporterInfo := ctx.OtherModuleProvider(dep, FlagExporterInfoProvider).(FlagExporterInfo)
diff --git a/cc/linker.go b/cc/linker.go
index 257fe86cf..357d1cee0 100644
--- a/cc/linker.go
+++ b/cc/linker.go
@@ -214,6 +214,11 @@ type BaseLinkerProperties struct {
// variant of the C/C++ module.
Exclude_static_libs []string
}
+ Non_apex struct {
+ // list of shared libs that should not be used to build the non-apex
+ // variant of the C/C++ module.
+ Exclude_shared_libs []string
+ }
} `android:"arch_variant"`
// make android::build:GetBuildNumber() available containing the build ID.
@@ -300,6 +305,10 @@ func (linker *baseLinker) linkerDeps(ctx DepsContext, deps Deps) Deps {
// variants.
deps.ExcludeLibsForApex = append(deps.ExcludeLibsForApex, linker.Properties.Target.Apex.Exclude_shared_libs...)
deps.ExcludeLibsForApex = append(deps.ExcludeLibsForApex, linker.Properties.Target.Apex.Exclude_static_libs...)
+ // Record the libraries that need to be excluded when building for non-APEX variants
+ // for the same reason above. This is used for marking deps and marked deps are
+ // ignored for non-apex variants.
+ deps.ExcludeLibsForNonApex = append(deps.ExcludeLibsForNonApex, linker.Properties.Target.Non_apex.Exclude_shared_libs...)
if Bool(linker.Properties.Use_version_lib) {
deps.WholeStaticLibs = append(deps.WholeStaticLibs, "libbuildversion")