Android builds: add liblog only to dynlibs & executables + remove it from heapprofd_client
Note that this also ends up stripping liblog from the static libs, which seems fine.
heapprofd_client's DT_NEEDED after this change:
0x0000000000000001 (NEEDED) Shared library: [libbase.so]
0x0000000000000001 (NEEDED) Shared library: [libprocinfo.so]
0x0000000000000001 (NEEDED) Shared library: [libunwindstack.so]
0x0000000000000001 (NEEDED) Shared library: [libc++.so]
0x0000000000000001 (NEEDED) Shared library: [libc.so]
0x0000000000000001 (NEEDED) Shared library: [libm.so]
0x0000000000000001 (NEEDED) Shared library: [libdl.so]
Change-Id: I777921f86794f5d3dc95483fb2e421e8fd90d379
diff --git a/gn/standalone/BUILD.gn b/gn/standalone/BUILD.gn
index e7aabf0..ee17fff 100644
--- a/gn/standalone/BUILD.gn
+++ b/gn/standalone/BUILD.gn
@@ -120,10 +120,6 @@
]
}
- if (is_android) {
- libs += [ "log" ]
- }
-
if (is_debug) {
libs += [ "dl" ]
}
@@ -241,3 +237,13 @@
]
}
}
+
+# This config is only added to certain leaf target types (see BUILDCONFIG.gn).
+# This allows us to remove the config (and thus the dependency) on a per-target
+# basis. If the config was applied to source_sets, then they would unavoidably
+# carry the dependency onto liblog to the final target.
+config("android_liblog") {
+ if (is_android) {
+ libs = [ "log" ]
+ }
+}