Statically link libdl.a to linker

When libbase is built for an APEX, it uses dlsym to reflectively access
liblog symbols that are added in R. This is because the APEX where
libbasse is packaged into might be running in pre-R devices where the
symbols don't exist in liblog.so.

This however causes a problem for a static executable in an APEX. Since
it is in an APEX, the dlsym is used. But libdl.so which provides dlsym
is not available to static executable. Currently, the dynamic linker is
the only executable in an APEX that all of its dependencies are
statically linked. Fixing the issue by providing fake dlsym by
statically linking to libdl.a.

Bug: 149569129
Test: m

Change-Id: I2e9e45d9876c2d6c878e541715389e6d1ef56996
diff --git a/libdl/Android.bp b/libdl/Android.bp
index 59f1937..a94b7f5 100644
--- a/libdl/Android.bp
+++ b/libdl/Android.bp
@@ -29,6 +29,11 @@
     sanitize: {
         never: true,
     },
+
+    apex_available: [
+        "//apex_available:platform",
+        "com.android.runtime",
+    ],
 }
 
 cc_library {
diff --git a/linker/Android.bp b/linker/Android.bp
index 4be080b..3190870 100644
--- a/linker/Android.bp
+++ b/linker/Android.bp
@@ -98,6 +98,7 @@
     static_libs: [
         "libziparchive",
         "libbase",
+        "libdl", // libbase uses dlsym
         "libz",
 
         "libasync_safe",