linker: Make the errors reported by dlopen/dlsym be more useful.
Changed it so that when the linker generates error messages, they are
scribbled away into a buffer that dlfcn and friends can read from.
Since the error messages are generetad with snprintf, and snprintf
MAY call malloc during some code paths, we now link against a version
of libc that does not contain malloc/free/realloc/calloc. We then define
malloc and friends in the dynamic loader, and make them abort() if they
are ever called.
Signed-off-by: Dima Zavin <dima@android.com>
diff --git a/linker/Android.mk b/linker/Android.mk
index 48141be..3d3ad92 100644
--- a/linker/Android.mk
+++ b/linker/Android.mk
@@ -37,7 +37,7 @@
LOCAL_MODULE:= linker
-LOCAL_STATIC_LIBRARIES := libcutils libc
+LOCAL_STATIC_LIBRARIES := libcutils libc_nomalloc
#LOCAL_FORCE_STATIC_EXECUTABLE := true # not necessary when not including BUILD_EXECUTABLE