Dynamically link to libz
libz will be a stub providing library, which means it has stable API
surface that Mainline modules can depend on. APEXes including the
runtime APEX don't need to statically link to it; it will just increase
the size of the APEX. With ag/11420260 this is even prohibited.
This change changes the static linkings to libz to dynamic linkings.
Bug: 155456180
Test: m
Change-Id: Ic6a38909241c8f851bf299130542bc323a0ff2ef
diff --git a/dex2oat/Android.bp b/dex2oat/Android.bp
index 25ec0a8..d1cf4ee 100644
--- a/dex2oat/Android.bp
+++ b/dex2oat/Android.bp
@@ -55,24 +55,14 @@
},
},
- target: {
- android: {
- static_libs: [
- "libz",
- ],
- },
- host: {
- shared_libs: [
- "libz",
- ],
- },
- },
generated_sources: ["art_dex2oat_operator_srcs"],
shared_libs: [
"libbase",
// For SHA-1 checksumming of build ID
"libcrypto",
+
+ "libz",
],
export_include_dirs: ["."],
}
@@ -250,6 +240,7 @@
"libartpalette",
"libbase",
"libsigchain",
+ "libz",
],
static_libs: [
"libart-dex2oat",
@@ -277,14 +268,8 @@
lto: {
thin: true,
},
- static_libs: [
- "libz",
- ],
},
host: {
- shared_libs: [
- "libz",
- ],
// Override the prefer32 added by art_cc_binary when
// HOST_PREFER_32_BIT is in use. Necessary because the logic in
// Soong for setting ctx.Config().BuildOSTarget (used in
@@ -322,20 +307,13 @@
"libartpalette",
"libbase",
"libsigchain",
+ "libz",
],
static_libs: [
"libartd-dex2oat",
],
target: {
- android: {
- static_libs: [
- "libz",
- ],
- },
host: {
- shared_libs: [
- "libz",
- ],
// Override the prefer32 added by art_cc_binary when
// HOST_PREFER_32_BIT is in use. Necessary because the logic in
// Soong for setting ctx.Config().BuildOSTarget (used in
diff --git a/dexlayout/Android.bp b/dexlayout/Android.bp
index ccdfd78..44af58d 100644
--- a/dexlayout/Android.bp
+++ b/dexlayout/Android.bp
@@ -53,7 +53,7 @@
],
},
},
- static_libs: ["libz"],
+ shared_libs: ["libz"],
}
cc_defaults {
diff --git a/libartbase/Android.bp b/libartbase/Android.bp
index 0f266c5..00ee3b9 100644
--- a/libartbase/Android.bp
+++ b/libartbase/Android.bp
@@ -62,9 +62,9 @@
static_libs: [
// ZipArchive support, the order matters here to get all symbols.
"libziparchive",
- "libz",
],
shared_libs: [
+ "libz",
"liblog",
// For ashmem.
"libartpalette",
diff --git a/libdexfile/Android.bp b/libdexfile/Android.bp
index 74390ec..c73908d 100644
--- a/libdexfile/Android.bp
+++ b/libdexfile/Android.bp
@@ -49,9 +49,10 @@
android: {
static_libs: [
"libziparchive",
- "libz",
],
shared_libs: [
+ // libz provides a stub from platform, shouldn't be statically linked
+ "libz",
// For MemMap.
"libartpalette",
"liblog",
diff --git a/libprofile/Android.bp b/libprofile/Android.bp
index 890c70c..23f3241 100644
--- a/libprofile/Android.bp
+++ b/libprofile/Android.bp
@@ -33,11 +33,11 @@
shared_libs: [
"libartpalette",
"libbase",
+ "libz",
],
static_libs: [
// ZipArchive support, the order matters here to get all symbols.
"libziparchive",
- "libz",
],
export_shared_lib_headers: ["libbase"],
},
diff --git a/runtime/Android.bp b/runtime/Android.bp
index fb7eab3..321dd01 100644
--- a/runtime/Android.bp
+++ b/runtime/Android.bp
@@ -372,8 +372,6 @@
],
shared_libs: [
"libdl_android",
- ],
- static_libs: [
"libz", // For adler32.
],
},