mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Ahmad Fatoum <a.fatoum@pengutronix.de>
To: "barebox@lists.infradead.org" <barebox@lists.infradead.org>
Subject: Re: [PATCH 11/13] stdio: stub out basprintf and friends when built for PBL
Date: Wed, 16 Oct 2024 11:40:41 +0200	[thread overview]
Message-ID: <2bdd5b97-e69a-4ee5-805f-cf4f54a5f4e7@pengutronix.de> (raw)
In-Reply-To: <20241016090150.3963002-12-a.fatoum@pengutronix.de>

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@pengutronix.de>
> ---
>  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 |



  parent reply	other threads:[~2024-10-16  9:47 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-10-16  9:01 [PATCH 00/13] Remove dependency on ld --gc-section in PBL Ahmad Fatoum
2024-10-16  9:01 ` [PATCH 01/13] kconfig: add IS_PROPER helper Ahmad Fatoum
2024-10-16  9:01 ` [PATCH 02/13] lib: random: add stubs for PBL Ahmad Fatoum
2024-10-16  9:01 ` [PATCH 03/13] bootsource: stub out when in PBL Ahmad Fatoum
2024-10-16  9:01 ` [PATCH 04/13] crypto: provide crypto_memneq for PBL Ahmad Fatoum
2024-10-16  9:01 ` [PATCH 05/13] cdev: stub out cdev_read/write " Ahmad Fatoum
2024-10-16  9:01 ` [PATCH 06/13] libfile: stub out file descriptor API " Ahmad Fatoum
2024-10-16  9:01 ` [PATCH 07/13] environment: stub out environment " Ahmad Fatoum
2024-10-16  9:01 ` [PATCH 08/13] of: stub out live tree API when using PBL Ahmad Fatoum
2024-10-16  9:01 ` [PATCH 09/13] errno: stub out perror/strerror API when built for PBL Ahmad Fatoum
2024-10-16  9:01 ` [PATCH 10/13] xfuncs: stub out " Ahmad Fatoum
2024-10-16  9:01 ` [PATCH 11/13] stdio: stub out basprintf and friends " Ahmad Fatoum
2024-10-16  9:40   ` [PATCH] fixup! errno: stub out perror/strerror API " Ahmad Fatoum
2024-10-16  9:40   ` Ahmad Fatoum [this message]
2024-10-16  9:01 ` [PATCH 12/13] memory: stub out request_barebox_region " Ahmad Fatoum
2024-10-16  9:01 ` [PATCH 13/13] malloc: add PBL stubs Ahmad Fatoum

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=2bdd5b97-e69a-4ee5-805f-cf4f54a5f4e7@pengutronix.de \
    --to=a.fatoum@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox