On 16.10.24 11:01, Ahmad Fatoum wrote: > To optimize out calls to undefined functions in PBL at compile-time > instead of link time, let's define stubs for the functions that > are referenced in obj-pbl-y files, but inside function sections > that are ultimately unreferenced. This one patch could use some more love, so please drop it. The other 12 (+ fixup) pass CI ok. Thanks, Ahmad > > Signed-off-by: Ahmad Fatoum <a.fatoum@xxxxxxxxxxxxxx> > --- > include/stdio.h | 24 ++++++++++++++++++++++-- > 1 file changed, 22 insertions(+), 2 deletions(-) > > diff --git a/include/stdio.h b/include/stdio.h > index 1ed7e1d3e38b..64deec64e66c 100644 > --- a/include/stdio.h > +++ b/include/stdio.h > @@ -17,12 +17,32 @@ int sprintf(char *buf, const char *fmt, ...) __attribute__ ((format(__printf__, > int snprintf(char *buf, size_t size, const char *fmt, ...) __attribute__ ((format(__printf__, 3, 4))); > int scnprintf(char *buf, size_t size, const char *fmt, ...) __attribute__ ((format(__printf__, 3, 4))); > int vsprintf(char *buf, const char *fmt, va_list args); > +int vsnprintf(char *buf, size_t size, const char *fmt, va_list args); > +int vscnprintf(char *buf, size_t size, const char *fmt, va_list args); > + > +#ifndef __PBL__ > char *basprintf(const char *fmt, ...) __attribute__ ((format(__printf__, 1, 2))); > int asprintf(char **strp, const char *fmt, ...) __attribute__ ((format(__printf__, 2, 3))); > char *bvasprintf(const char *fmt, va_list ap); > int vasprintf(char **strp, const char *fmt, va_list ap); > -int vsnprintf(char *buf, size_t size, const char *fmt, va_list args); > -int vscnprintf(char *buf, size_t size, const char *fmt, va_list args); > +#else > +static inline char *basprintf(const char *fmt, ...) > +{ > + return NULL; > +} > +static inline int asprintf(char **strp, const char *fmt, ...) > +{ > + return -ENOMEM; > +} > +static inline char *bvasprintf(const char *fmt, va_list ap) > +{ > + return NULL; > +} > +static inline int vasprintf(char **strp, const char *fmt, va_list ap) > +{ > + return -ENOMEM; > +} > +#endif > > #ifdef CONFIG_ARCH_HAS_CTRLC > int arch_ctrlc(void); -- Pengutronix e.K. | | Steuerwalder Str. 21 | http://www.pengutronix.de/ | 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |