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.
This commit is contained in:
David 'Digit' Turner
2010-01-20 12:36:51 -08:00
parent e100f52f4a
commit 5c734644ee
7 changed files with 809 additions and 15 deletions

View File

@@ -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 pthread_mutex_t dl_lock = PTHREAD_MUTEX_INITIALIZER;
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];
};