Merge changes from topic "python_entry_point"
* changes:
python par: trim and convert the entry point at build time
Fix par file zip offsets
diff --git a/cc/library.go b/cc/library.go
index a9d63f9..8b8fe02 100644
--- a/cc/library.go
+++ b/cc/library.go
@@ -32,19 +32,21 @@
Srcs []string `android:"arch_variant"`
Cflags []string `android:"arch_variant"`
- Enabled *bool `android:"arch_variant"`
- Whole_static_libs []string `android:"arch_variant"`
- Static_libs []string `android:"arch_variant"`
- Shared_libs []string `android:"arch_variant"`
+ Enabled *bool `android:"arch_variant"`
+ Whole_static_libs []string `android:"arch_variant"`
+ Static_libs []string `android:"arch_variant"`
+ Shared_libs []string `android:"arch_variant"`
+ System_shared_libs []string `android:"arch_variant"`
} `android:"arch_variant"`
Shared struct {
Srcs []string `android:"arch_variant"`
Cflags []string `android:"arch_variant"`
- Enabled *bool `android:"arch_variant"`
- Whole_static_libs []string `android:"arch_variant"`
- Static_libs []string `android:"arch_variant"`
- Shared_libs []string `android:"arch_variant"`
+ Enabled *bool `android:"arch_variant"`
+ Whole_static_libs []string `android:"arch_variant"`
+ Static_libs []string `android:"arch_variant"`
+ Shared_libs []string `android:"arch_variant"`
+ System_shared_libs []string `android:"arch_variant"`
} `android:"arch_variant"`
// local file name to pass to the linker as -unexported_symbols_list
@@ -488,6 +490,16 @@
}
func (library *libraryDecorator) linkerDeps(ctx DepsContext, deps Deps) Deps {
+ if library.static() {
+ if library.Properties.Static.System_shared_libs != nil {
+ library.baseLinker.Properties.System_shared_libs = library.Properties.Static.System_shared_libs
+ }
+ } else if library.shared() {
+ if library.Properties.Shared.System_shared_libs != nil {
+ library.baseLinker.Properties.System_shared_libs = library.Properties.Shared.System_shared_libs
+ }
+ }
+
deps = library.baseLinker.linkerDeps(ctx, deps)
if library.static() {
@@ -921,8 +933,19 @@
func reuseStaticLibrary(mctx android.BottomUpMutatorContext, static, shared *Module) {
if staticCompiler, ok := static.compiler.(*libraryDecorator); ok {
sharedCompiler := shared.compiler.(*libraryDecorator)
+
+ // Check libraries in addition to cflags, since libraries may be exporting different
+ // include directories.
if len(staticCompiler.Properties.Static.Cflags) == 0 &&
- len(sharedCompiler.Properties.Shared.Cflags) == 0 {
+ len(sharedCompiler.Properties.Shared.Cflags) == 0 &&
+ len(staticCompiler.Properties.Static.Whole_static_libs) == 0 &&
+ len(sharedCompiler.Properties.Shared.Whole_static_libs) == 0 &&
+ len(staticCompiler.Properties.Static.Static_libs) == 0 &&
+ len(sharedCompiler.Properties.Shared.Static_libs) == 0 &&
+ len(staticCompiler.Properties.Static.Shared_libs) == 0 &&
+ len(sharedCompiler.Properties.Shared.Shared_libs) == 0 &&
+ staticCompiler.Properties.Static.System_shared_libs == nil &&
+ sharedCompiler.Properties.Shared.System_shared_libs == nil {
mctx.AddInterVariantDependency(reuseObjTag, shared, static)
sharedCompiler.baseCompiler.Properties.OriginalSrcs =
diff --git a/cc/linker.go b/cc/linker.go
index 3c51690..854dfc5 100644
--- a/cc/linker.go
+++ b/cc/linker.go
@@ -49,7 +49,7 @@
// 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
+ System_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
@@ -237,35 +237,34 @@
deps.LateStaticLibs = append(deps.LateStaticLibs, "libgcc")
}
- if !ctx.static() {
- systemSharedLibs := linker.Properties.System_shared_libs
- if systemSharedLibs == nil {
- systemSharedLibs = []string{"libc", "libm", "libdl"}
- }
-
- if inList("libdl", deps.SharedLibs) {
- // If system_shared_libs has libc but not libdl, make sure shared_libs does not
- // have libdl to avoid loading libdl before libc.
- if inList("libc", systemSharedLibs) {
- if !inList("libdl", systemSharedLibs) {
- ctx.PropertyErrorf("shared_libs",
- "libdl must be in system_shared_libs, not shared_libs")
- }
- _, deps.SharedLibs = removeFromList("libdl", deps.SharedLibs)
- }
- }
-
- // If libc and libdl are both in system_shared_libs make sure libd comes after libc
- // to avoid loading libdl before libc.
- if inList("libdl", systemSharedLibs) && inList("libc", systemSharedLibs) &&
- indexList("libdl", systemSharedLibs) < indexList("libc", systemSharedLibs) {
- ctx.PropertyErrorf("system_shared_libs", "libdl must be after libc")
- }
-
- deps.LateSharedLibs = append(deps.LateSharedLibs, systemSharedLibs...)
- } else if ctx.useSdk() || ctx.useVndk() {
- deps.LateSharedLibs = append(deps.LateSharedLibs, "libc", "libm", "libdl")
+ var systemSharedLibs []string
+ if !ctx.useSdk() && !ctx.useVndk() {
+ systemSharedLibs = linker.Properties.System_shared_libs
}
+ if systemSharedLibs == nil {
+ systemSharedLibs = []string{"libc", "libm", "libdl"}
+ }
+
+ if inList("libdl", deps.SharedLibs) {
+ // If system_shared_libs has libc but not libdl, make sure shared_libs does not
+ // have libdl to avoid loading libdl before libc.
+ if inList("libc", systemSharedLibs) {
+ if !inList("libdl", systemSharedLibs) {
+ ctx.PropertyErrorf("shared_libs",
+ "libdl must be in system_shared_libs, not shared_libs")
+ }
+ _, deps.SharedLibs = removeFromList("libdl", deps.SharedLibs)
+ }
+ }
+
+ // If libc and libdl are both in system_shared_libs make sure libdl comes after libc
+ // to avoid loading libdl before libc.
+ if inList("libdl", systemSharedLibs) && inList("libc", systemSharedLibs) &&
+ indexList("libdl", systemSharedLibs) < indexList("libc", systemSharedLibs) {
+ ctx.PropertyErrorf("system_shared_libs", "libdl must be after libc")
+ }
+
+ deps.LateSharedLibs = append(deps.LateSharedLibs, systemSharedLibs...)
}
if ctx.Windows() {