[PATCH 8/9] _exports.h: export standard memory/string handling functions
Rasmus Villemoes
ravi at prevas.dk
Fri Sep 19 12:10:01 CEST 2025
The current list of exported functions lacks quite a few bog-standard C
library functions that we might as well expose, since U-Boot certainly
has them implemented anyway. There's no reason a standalone
application should have its own strlen() implementation or link in a
copy from some tiny libc.
For a customer's standalone app, this means it goes from 95K to 10K.
More importantly, we can ditch the custom toolchain including a
newlibc used to build the standalone app and just use the same
toolchain as used to build u-boot itself.
Signed-off-by: Rasmus Villemoes <ravi at prevas.dk>
---
include/_exports.h | 14 ++++++++++++++
1 file changed, 14 insertions(+)
diff --git a/include/_exports.h b/include/_exports.h
index f1b11c1e380..a23fc001421 100644
--- a/include/_exports.h
+++ b/include/_exports.h
@@ -23,6 +23,8 @@
EXPORT_FUNC(irq_free_handler, void, free_hdlr, int)
#endif
EXPORT_FUNC(malloc, void *, malloc, size_t)
+ EXPORT_FUNC(realloc, void *, realloc, void *, size_t)
+ EXPORT_FUNC(calloc, void *, calloc, size_t, size_t)
#if !CONFIG_IS_ENABLED(SYS_MALLOC_SIMPLE)
EXPORT_FUNC(free, void, free, void *)
#endif
@@ -43,9 +45,21 @@
const char *, char **, unsigned int)
EXPORT_FUNC(ustrtoull, unsigned long long, ustrtoull,
const char *, char **, unsigned int)
+ EXPORT_FUNC(memcmp, int, memcmp, const void *, const void *, size_t)
+ EXPORT_FUNC(memcpy, void *, memcpy, void *, const void *, size_t)
+ EXPORT_FUNC(memmove, void *, memmove, void *, const void *, size_t)
EXPORT_FUNC(memset, void *, memset, void *, int, size_t)
+ EXPORT_FUNC(strchr, char *, strchr, const char *cs, int c)
+ EXPORT_FUNC(strlen, size_t, strlen, const char *s)
+ EXPORT_FUNC(strncmp, int, strncmp, const char *cs, const char *ct, size_t n)
+ EXPORT_FUNC(strncpy, char *, strncpy, char *dest, const char *src, size_t n)
+ EXPORT_FUNC(strnlen, size_t, strnlen, const char *s, size_t n)
EXPORT_FUNC(strcmp, int, strcmp, const char *cs, const char *ct)
EXPORT_FUNC(strcpy, char *, strcpy, char *dest, const char *src)
+ EXPORT_FUNC(sprintf, int, sprintf, char *, const char *, ...)
+ EXPORT_FUNC(snprintf, int, snprintf, char *, size_t, const char *, ...)
+ EXPORT_FUNC(vsprintf, int, vsprintf, char *, const char *, va_list)
+ EXPORT_FUNC(vsnprintf, int, vsnprintf, char *, size_t, const char *, va_list)
#if defined(CONFIG_CMD_I2C) && CONFIG_IS_ENABLED(SYS_I2C_LEGACY)
EXPORT_FUNC(i2c_write, int, i2c_write, uchar, uint, int , uchar * , int)
EXPORT_FUNC(i2c_read, int, i2c_read, uchar, uint, int , uchar * , int)
--
2.51.0
More information about the U-Boot
mailing list