Make libdl symbols weak.
Also make a static library which can be used to override these symbols
in other implementations of libdl.so
Test: make
Change-Id: Id433bb07ecbfc4955c3fb7591ace971c2cda7862
diff --git a/libdl/Android.bp b/libdl/Android.bp
index 9f67ee8..b0bbe99 100644
--- a/libdl/Android.bp
+++ b/libdl/Android.bp
@@ -1,6 +1,28 @@
//
// libdl
//
+cc_library_static {
+ name: "libdl_static",
+
+ srcs: ["libdl.c", "libdl_cfi.cpp"],
+
+ cflags: [
+ "-Wall",
+ "-Wextra",
+ "-Wunused",
+ "-Werror",
+ ],
+
+ // For private/CFIShadow.h.
+ include_dirs: ["bionic/libc"],
+
+ stl: "none",
+
+ sanitize: {
+ never: true,
+ },
+}
+
cc_library {
name: "libdl",
@@ -45,7 +67,7 @@
},
},
shared: {
- srcs: ["libdl.c", "libdl_cfi.cpp"],
+ whole_static_libs: ["libdl_static"],
},
static: {
srcs: [ "libdl_static.c" ],
@@ -66,9 +88,6 @@
allow_undefined_symbols: true,
system_shared_libs: [],
- // For private/CFIShadow.h.
- include_dirs: ["bionic/libc"],
-
// This is placeholder library the actual implementation is (currently)
// provided by the linker.
shared_libs: [ "ld-android" ],