Remove default_shared_libs

system_shared_libs has been modified to have the same behavior as
the newly added default_shared_libs, remove default_shared_libs in
favor of system_shared_libs.

This reverts Ia2349d84c70e503916f90a5d2702e135248f73df and renames
the default_shared_libs property in cc_object (which never had
system_shared_libs) to system_shared_libs.

Bug: 193559105
Test: m checkbuild
Change-Id: I46672e3a096b6ea94ff4c10e1c31e8fd010a163c
This commit is contained in:
Colin Cross
2021-07-22 11:39:44 -07:00
parent 72bf8e1310
commit 6b8f4253eb
8 changed files with 37 additions and 232 deletions

View File

@@ -46,18 +46,11 @@ type BaseLinkerProperties struct {
// list of module-specific flags that will be used for all link steps
Ldflags []string `android:"arch_variant"`
// list of system libraries that will be dynamically linked to shared library and executable
// modules that build against bionic (device or Linux bionic modules). If unset, generally
// defaults to libc, libm, and libdl. Set to [] to prevent linking against the defaults.
// Equivalent to default_shared_libs for modules that build against bionic, and ignored on
// modules that do not build against bionic.
// list of system libraries that will be dynamically linked to
// shared library and executable modules. If unset, generally defaults to libc,
// libm, and libdl. Set to [] to prevent linking against the defaults.
System_shared_libs []string `android:"arch_variant"`
// list of system libraries that will be dynamically linked to shared library and executable
// modules. If unset, generally defaults to libc, libm, and libdl. Set to [] to prevent
// linking against the defaults. Equivalent to system_shared_libs, but applies to all modules.
Default_shared_libs []string `android:"arch_variant"`
// allow the module to contain undefined symbols. By default,
// modules cannot contain undefined symbols that are not satisified by their immediate
// dependencies. Set this flag to true to remove --no-undefined from the linker flags.
@@ -239,18 +232,6 @@ func (linker *baseLinker) appendLdflags(flags []string) {
linker.Properties.Ldflags = append(linker.Properties.Ldflags, flags...)
}
// overrideDefaultSharedLibraries returns the contents of the default_shared_libs or
// system_shared_libs properties, and records an error if both are set.
func (linker *baseLinker) overrideDefaultSharedLibraries(ctx BaseModuleContext) []string {
if linker.Properties.System_shared_libs != nil && linker.Properties.Default_shared_libs != nil {
ctx.PropertyErrorf("system_shared_libs", "cannot be specified if default_shared_libs is also specified")
}
if linker.Properties.System_shared_libs != nil {
return linker.Properties.System_shared_libs
}
return linker.Properties.Default_shared_libs
}
// linkerInit initializes dynamic properties of the linker (such as runpath).
func (linker *baseLinker) linkerInit(ctx BaseModuleContext) {
if ctx.toolchain().Is64Bit() {
@@ -351,13 +332,13 @@ func (linker *baseLinker) linkerDeps(ctx DepsContext, deps Deps) Deps {
deps.SharedLibs = append(deps.SharedLibs, linker.Properties.Target.Platform.Shared_libs...)
}
deps.SystemSharedLibs = linker.overrideDefaultSharedLibraries(ctx)
deps.SystemSharedLibs = linker.Properties.System_shared_libs
// In Bazel conversion mode, variations have not been specified, so SystemSharedLibs may
// inaccuarately appear unset, which can cause issues with circular dependencies.
if deps.SystemSharedLibs == nil && !ctx.BazelConversionMode() {
// Provide a default set of shared libraries if default_shared_libs and system_shared_libs
// are unspecified. Note: If an empty list [] is specified, it implies that the module
// declines the default shared libraries.
// Provide a default system_shared_libs if it is unspecified. Note: If an
// empty list [] is specified, it implies that the module declines the
// default system_shared_libs.
deps.SystemSharedLibs = append(deps.SystemSharedLibs, ctx.toolchain().DefaultSharedLibraries()...)
}
@@ -593,11 +574,6 @@ func (linker *baseLinker) linkerSpecifiedDeps(specifiedDeps specifiedDeps) speci
} else {
specifiedDeps.systemSharedLibs = append(specifiedDeps.systemSharedLibs, linker.Properties.System_shared_libs...)
}
if specifiedDeps.defaultSharedLibs == nil {
specifiedDeps.defaultSharedLibs = linker.Properties.Default_shared_libs
} else {
specifiedDeps.defaultSharedLibs = append(specifiedDeps.defaultSharedLibs, linker.Properties.Default_shared_libs...)
}
return specifiedDeps
}