cpython3: Export symbols from interpreter to be used in extensions

* Python native symbols need to be exported by the interpreter to be
  used by native extensions. Otherwise errors could happen when the
  interpreter tries to load an extension module compiled as a shared
  library
* Error 1: Extension module built with "allow_undefined_symbol", Python
  interpreter built with static linkage to its C libraries
    To use the extension module, dlopen() needs to find Python symbols
    like PyBaseObject_Type. If Python interpreter and its C libraries are
    linked staticly, such symbol cannot be exported to the dependent
    extension module loaded via a shared library. Importing the library
    will result in dlopen errors like "undefined symbol"
* Error 2: Extension module built with static linkage to Python C
  libraries while Python interpreter is also built with static linkage
  to its C libraries
    Importing the extension module will result in duplicate symbols
    defined in both Python interpreter and the extension module. The
    interpreter will likely crash in this case
* Exporting PyObject and PyBaseObject symbols from the interpreter
  allows the imported extension to use them at run time

Bug: 143374372
Test: make and load Python extension module
Change-Id: Ice7d0e6e6e7f1cfe9e168d5463c363189c053032
diff --git a/Android.bp b/Android.bp
index 38295dc..a43b89d 100644
--- a/Android.bp
+++ b/Android.bp
@@ -252,6 +252,13 @@
         linux_glibc_x86_64: {
             host_ldlibs: ["-lutil"],
         },
+        linux: {
+            // Due to test infra limitations, Python native symbols are linked
+            // statically to py3-launcher(s). Hence, need this flag to export
+            // these symbols so that runtime imported native extensions can use
+            // them (e.g. PyBaseObject_Type)
+            ldflags: ["-Wl,--export-dynamic"],
+        },
         darwin: {
             host_ldlibs: [
                 "-framework SystemConfiguration",
@@ -261,10 +268,14 @@
         host: {
             static_libs: ["libsqlite"],
         },
-        // Use shared libsqlite for device side, otherwise
-        // the executable size will be really huge.
         android: {
-            shared_libs: ["libsqlite"],
+            shared_libs: [
+                // Use shared libsqlite for device side, otherwise
+                // the executable size will be really huge.
+                "libsqlite",
+                // Dependency from libbase
+                "liblog",
+            ],
         },
     },
 }