lib/utils/printf: Apply workaround for static linking with uclibc.

uclibc objects call __GI_vsnprintf().
This commit is contained in:
Paul Sokolovsky 2015-12-10 14:42:01 +02:00
parent 645045a799
commit 1f0aaece3a
1 changed files with 6 additions and 0 deletions

View File

@ -102,6 +102,12 @@ STATIC void strn_print_strn(void *data, const char *str, size_t len) {
strn_print_env->remain -= len; strn_print_env->remain -= len;
} }
#ifdef __GNUC__
// uClibc requires this alias to be defined, or there may be link errors
// when linkings against it statically.
int __GI_vsnprintf(char *str, size_t size, const char *fmt, va_list ap) __attribute__((weak, alias ("vsnprintf")));
#endif
int vsnprintf(char *str, size_t size, const char *fmt, va_list ap) { int vsnprintf(char *str, size_t size, const char *fmt, va_list ap) {
strn_print_env_t strn_print_env = {str, size}; strn_print_env_t strn_print_env = {str, size};
mp_print_t print = {&strn_print_env, strn_print_strn}; mp_print_t print = {&strn_print_env, strn_print_strn};