Separate libc_common to two targets

Adds libc_common_static and libc_common_shared targets. So that static
and shared objects can use different libraries.

In following changes I'll add dynamic dispatch code to
libc_common_shared.

Test: compile and run bionic unit test.
Change-Id: I056742fdf8af76ed7deb274c515951656b176fcb
diff --git a/libc/Android.bp b/libc/Android.bp
index 2ba4f78..46e3550 100644
--- a/libc/Android.bp
+++ b/libc/Android.bp
@@ -1656,6 +1656,30 @@
 }
 
 // ========================================================
+// libc_common_static.a For static binaries.
+// ========================================================
+cc_library_static {
+    defaults: ["libc_defaults"],
+    name: "libc_common_static",
+
+    whole_static_libs: [
+        "libc_common",
+    ],
+}
+
+// ========================================================
+// libc_common_shared.a For shared libraries.
+// ========================================================
+cc_library_static {
+    defaults: ["libc_defaults"],
+    name: "libc_common_shared",
+
+    whole_static_libs: [
+        "libc_common",
+    ],
+}
+
+// ========================================================
 // libc_nomalloc.a
 // ========================================================
 //
@@ -1679,7 +1703,7 @@
     cflags: ["-DLIBC_STATIC"],
 
     whole_static_libs: [
-        "libc_common",
+        "libc_common_static",
         "libc_init_static",
     ],
 }
@@ -1714,7 +1738,10 @@
             "bionic/malloc_common.cpp",
         ],
         cflags: ["-DLIBC_STATIC"],
-        whole_static_libs: ["libc_init_static"],
+        whole_static_libs: [
+            "libc_init_static",
+            "libc_common_static",
+        ],
     },
     shared: {
         srcs: [
@@ -1725,7 +1752,10 @@
             "bionic/NetdClient.cpp",
             "arch-common/bionic/crtend_so.S",
         ],
-        whole_static_libs: ["libc_init_dynamic"],
+        whole_static_libs: [
+            "libc_init_dynamic",
+            "libc_common_shared",
+        ],
     },
 
     required: ["tzdata"],
@@ -1752,7 +1782,6 @@
         "libdl",
     ],
     whole_static_libs: [
-        "libc_common",
         "libjemalloc",
     ],