From 5c734644eebf8d01be1e86cbe20a111a5c5a2738 Mon Sep 17 00:00:00 2001 From: David 'Digit' Turner Date: Wed, 20 Jan 2010 12:36:51 -0800 Subject: 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. --- linker/linker.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'linker/linker.c') diff --git a/linker/linker.c b/linker/linker.c index 40fdbab..7eb1ef9 100644 --- a/linker/linker.c +++ b/linker/linker.c @@ -48,6 +48,7 @@ #include "linker.h" #include "linker_debug.h" +#include "linker_format.h" #include "ba.h" @@ -142,7 +143,7 @@ static char tmp_err_buf[768]; static char __linker_dl_err_buf[768]; #define DL_ERR(fmt, x...) \ do { \ - snprintf(__linker_dl_err_buf, sizeof(__linker_dl_err_buf), \ + format_buffer(__linker_dl_err_buf, sizeof(__linker_dl_err_buf), \ "%s[%d]: " fmt, __func__, __LINE__, ##x); \ ERROR(fmt "\n", ##x); \ } while(0) @@ -584,7 +585,7 @@ static int open_library(const char *name) return fd; for (path = ldpaths; *path; path++) { - n = snprintf(buf, sizeof(buf), "%s/%s", *path, name); + n = format_buffer(buf, sizeof(buf), "%s/%s", *path, name); if (n < 0 || n >= (int)sizeof(buf)) { WARN("Ignoring very long library path: %s/%s\n", *path, name); continue; @@ -593,7 +594,7 @@ static int open_library(const char *name) return fd; } for (path = sopaths; *path; path++) { - n = snprintf(buf, sizeof(buf), "%s/%s", *path, name); + n = format_buffer(buf, sizeof(buf), "%s/%s", *path, name); if (n < 0 || n >= (int)sizeof(buf)) { WARN("Ignoring very long library path: %s/%s\n", *path, name); continue; -- cgit v1.1