Merge "Reland "Add libdl_android to the Runtime (aka Bionic) APEX"."
diff --git a/CleanSpec.mk b/CleanSpec.mk
index 8865723..e8dd26c 100644
--- a/CleanSpec.mk
+++ b/CleanSpec.mk
@@ -57,6 +57,11 @@
 $(call add-clean-step, rm -rf $(PRODUCT_OUT)/root/bionic)
 $(call add-clean-step, rm -rf $(PRODUCT_OUT)/recovery/root/bionic)
 
+# Ensure libdl_android.so is (only) in the correct locations after the move into
+# the Runtime APEX.
+$(call add-clean-step, rm -rf $(PRODUCT_OUT)/apex/com.android.runtime/lib{,64})
+$(call add-clean-step, rm -rf $(PRODUCT_OUT)/system/lib{,64})
+
 # ************************************************
 # NEWER CLEAN STEPS MUST BE AT THE END OF THE LIST
 # ************************************************
diff --git a/apex/Android.bp b/apex/Android.bp
index 276541e..4fbbec1 100644
--- a/apex/Android.bp
+++ b/apex/Android.bp
@@ -29,6 +29,7 @@
         "libc",
         "libm",
         "libdl",
+        "libdl_android",
         "libc_malloc_debug",
         "libc_malloc_hooks",
     ],
diff --git a/libdl/Android.bp b/libdl/Android.bp
index 15263e9..9daa9c4 100644
--- a/libdl/Android.bp
+++ b/libdl/Android.bp
@@ -185,6 +185,11 @@
         symbol_file: "libdl_android.map.txt",
         versions: ["10000"],
     },
+
+    apex_available: [
+        "//apex_available:platform",
+        "com.android.runtime",
+    ],
 }
 
 ndk_library {