linker: reduce size by nearly 20KB

This patch adds a trivial implementation of snprintf() that calls
our internal vsnprintf().

Inspection of the generated machine code showed that the linker
contained a full implementation of stdio's vfprintf. It was pulled
in because the pthread implementation uses snprintf() somewhere.

ProTip: It's possible to see why specific objects files are included
in a final binary by adding the following to your, then
looking at the content of /tmp/MAP.TXT:

  LOCAL_LDFLAGS += -Wl,-Map=/tmp/MAP.TXT

Change-Id: I325e71b0cad1d01116a2e00c09e30a80cb716aa3
diff --git a/linker/linker_format.c b/linker/linker_format.c
index 0c68a0b..cded68a 100644
--- a/linker/linker_format.c
+++ b/linker/linker_format.c
@@ -172,6 +172,21 @@
     return format_buffer(buff, bufsize, format, args);
+/* The pthread implementation uses snprintf(). If we define it here, we
+ * avoid pulling the stdio vfprintf() implementation into the linker
+ * saving about 19KB of machine code.
+ */
+snprintf(char* buff, size_t bufsize, const char* format, ...)
+    va_list args;
+    int ret;
+    va_start(args, format);
+    ret = vsnprintf(buff, bufsize, format, args);
+    va_end(args);
+    return ret;