[PATCH 1/3] cmd: avoid duplicate weak flush_dcache_all()

Tom Rini trini at konsulko.com
Wed Jun 19 19:19:36 CEST 2024


On Wed, Jun 19, 2024 at 03:23:36PM +0300, Ilias Apalodimas wrote:
> On Sun, 16 Jun 2024 at 20:31, Heinrich Schuchardt
> <heinrich.schuchardt at canonical.com> wrote:
> >
> > If we have multiple weak implementations of functions, the linker might
> > choose any of these. ARM and RISC-V already provide a weak implementation
> > of flush_dcache_all().
> >
> > Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt at canonical.com>
> > ---
> >  cmd/cache.c | 3 +++
> >  1 file changed, 3 insertions(+)
> >
> > diff --git a/cmd/cache.c b/cmd/cache.c
> > index 0254ff17f9b..16fa0f7c652 100644
> > --- a/cmd/cache.c
> > +++ b/cmd/cache.c
> > @@ -52,11 +52,14 @@ static int do_icache(struct cmd_tbl *cmdtp, int flag, int argc,
> >         return 0;
> >  }
> >
> > +/* ARM and RISC-V define a weak flush_dcache_all() themselves. */
> > +#if !defined(CONFIG_ARM) && !defined(CONFIG_RISCV)
> >  void __weak flush_dcache_all(void)
> >  {
> >         puts("No arch specific flush_dcache_all available!\n");
> >         /* please define arch specific flush_dcache_all */
> >  }
> 
> Aren't we supposed to add a single __weak function so the linker can
> replace it? IOW why is the declaration for Arm/riscv a weak one?

Yeah, I'm going to see about re-structuring this a little bit right now.

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 659 bytes
Desc: not available
URL: <https://lists.denx.de/pipermail/u-boot/attachments/20240619/6f7f4fa2/attachment.sig>


More information about the U-Boot mailing list