On Tue, Jul 21, 2026 at 11:58:01AM +0200, Quentin Schulz via U-Boot wrote: > Hi Jonas, > > On 7/9/26 12:05 AM, Jonas Karlman wrote: > > Use CONFIG_IS_ENABLED(LIBCOMMON_SUPPORT) instead of directly checking > > CONFIG_SPL_LIBCOMMON_SUPPORT when guarding printf/log calls to depend on > > correct xPL_LIBCOMMON_SUPPORT symbol. Also change to use IS_ENABLED() > > for the XPL_BUILD symbol checks for consistency. > > > > Signed-off-by: Jonas Karlman <[email protected]> > > --- > > boot/common_fit.c | 2 +- > > common/spl/spl_usb.c | 2 +- > > drivers/mmc/mmc-uclass.c | 4 ++-- > > drivers/mmc/mmc.c | 16 ++++++++-------- > > drivers/mmc/mmc_legacy.c | 4 ++-- > > include/spl.h | 6 +++--- > > lib/hang.c | 2 +- > > 7 files changed, 18 insertions(+), 18 deletions(-) > > > > diff --git a/boot/common_fit.c b/boot/common_fit.c > > index fd434fe28e19..9dcec1cd7d7d 100644 > > --- a/boot/common_fit.c > > +++ b/boot/common_fit.c > > @@ -53,7 +53,7 @@ int fit_find_config_node(const void *fdt) > > node = fdt_next_subnode(fdt, node)) { > > name = fdt_getprop(fdt, node, FIT_DESC_PROP, &len); > > if (!name) { > > -#ifdef CONFIG_SPL_LIBCOMMON_SUPPORT > > +#if !IS_ENABLED(CONFIG_XPL_BUILD) || CONFIG_IS_ENABLED(LIBCOMMON_SUPPORT) > > I'm stuck on this and cannot make sense of it. I understand we don't have a > CONFIG_LIBCOMMON_SUPPORT and we may want to printf in proper anyway... > > I guess the issue is that if we use CONFIG_IS_ENABLED(LIBCOMMON_SUPPORT), we > will not check for CONFIG_SPL_LIBCOMMON_SUPPORT in proper (which is > incorrect but what we're doing today) anymore and thus the printf won't be > compiled in. > > I'm thinking the right approach would be to define a > > config LIBCOMMON_SUPPORT > def_bool y > help > Enable support for common U-Boot libraries. [...] > > and replace all > > #if !defined(CONFIG_XPL_BUILD) || defined(CONFIG_SPL_LIBCOMMON_SUPPORT) > > with > > #if CONFIG_IS_ENABLED(LIBCOMMON_SUPPORT) > > I'm assuming we don't have an issue with TPL using SPL_LIBCOMMON_SUPPORT > without TPL_LIBCOMMON_SUPPORT as it won't be able to link due to missing > library support in TPL? > > Then we can simply replace the above in boot/common_fit.c with > CONFIG_IS_ENABLED(LIBCOMMON_SUPPORT). > > We may have an issue with > libs-$(CONFIG_$(PHASE_)LIBCOMMON_SUPPORT) += boot/ common/ cmd/ env/ > in scripts/Makefile.xpl as those directories will already be in libs-y via > the root Makefile for proper?
Since there's more discussion on this particular patch, maybe we should
rework it. I had thought we had things done such that if code does:
printf("foo\n");
and we don't have the appropriate LIBCOMMON enabled, it got zero'd out,
and so we wouldn't need to litter all of the codebase with ifdefs, as
that would become unreadable. Which leads me to think these cases must
be fairly special.
--
Tom
signature.asc
Description: PGP signature
