]> git.ipfire.org Git - thirdparty/u-boot.git/commitdiff
_exports.h: export standard memory/string handling functions
authorRasmus Villemoes <ravi@prevas.dk>
Fri, 19 Sep 2025 10:10:01 +0000 (12:10 +0200)
committerTom Rini <trini@konsulko.com>
Fri, 26 Sep 2025 17:55:13 +0000 (11:55 -0600)
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@prevas.dk>
Reviewed-by: Tom Rini <trini@konsulko.com>
include/_exports.h

index f1b11c1e380f6763501fa76f9dbb5fbde65202c9..a23fc00142158188c97cdf8cd533fe37e6f202a3 100644 (file)
@@ -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
                    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)