summaryrefslogtreecommitdiffstats
path: root/linker/linker.c
diff options
context:
space:
mode:
authorDavid 'Digit' Turner <digit@google.com>2010-01-20 12:36:51 -0800
committerDavid 'Digit' Turner <digit@google.com>2010-02-11 10:46:48 -0800
commit5c734644eebf8d01be1e86cbe20a111a5c5a2738 (patch)
tree5e442dc0157ec487f51a65f85f87fe2bd66fd0cf /linker/linker.c
parente100f52f4ad1b70762bbcc5ad9828bd258917ee5 (diff)
downloadbionic-5c734644eebf8d01be1e86cbe20a111a5c5a2738.zip
bionic-5c734644eebf8d01be1e86cbe20a111a5c5a2738.tar.gz
bionic-5c734644eebf8d01be1e86cbe20a111a5c5a2738.tar.bz2
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.
Diffstat (limited to 'linker/linker.c')
-rw-r--r--linker/linker.c7
1 files changed, 4 insertions, 3 deletions
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;