Fix debug output in the dynamic linker.
This provides a mini-printf implementation that reduces the
size of the dynamic linker by 25 KB, by preventing the drag of
formatting-related routines from the C library.
Also allow traces to be sent to the log, instead of stdout.
NOTE: You now need to modify Android.mk to enable/disable debug
output.
diff --git a/linker/dlfcn.c b/linker/dlfcn.c
index 039926c..bc6b95a 100644
--- a/linker/dlfcn.c
+++ b/linker/dlfcn.c
@@ -17,6 +17,7 @@
#include <pthread.h>
#include <stdio.h>
#include "linker.h"
+#include "linker_format.h"
/* This file hijacks the symbols stubbed out in libdl.so. */
@@ -45,7 +46,7 @@
static void set_dlerror(int err)
{
- snprintf(dl_err_buf, sizeof(dl_err_buf), "%s: %s", dl_errors[err],
+ format_buffer(dl_err_buf, sizeof(dl_err_buf), "%s: %s", dl_errors[err],
linker_get_error());
dl_err_str = (const char *)&dl_err_buf[0];
};