[PATCH 17/31] sandbox: Allow weak symbols to be dropped

Simon Glass sjg at chromium.org
Sat Apr 29 20:41:19 CEST 2023


Hi Bin,

On Mon, 24 Apr 2023 at 20:44, Bin Meng <bmeng.cn at gmail.com> wrote:
>
> Hi Simon,
>
> On Tue, Apr 25, 2023 at 7:09 AM Simon Glass <sjg at chromium.org> wrote:
> >
> > The sandbox build makes use of a small number of weak symbols. Allow these
> > to be dropped when building for the PE format, since its support for weak
> > symbols is poor.
> >
> > Signed-off-by: Simon Glass <sjg at chromium.org>
> > ---
> >
> >  cmd/bootefi.c                     | 3 ++-
> >  cmd/bootz.c                       | 3 +++
> >  common/usb.c                      | 3 +++
> >  drivers/core/root.c               | 3 +++
> >  drivers/spi/sandbox_spi.c         | 3 +++
> >  env/env.c                         | 6 ++++++
> >  lib/efi_loader/efi_image_loader.c | 3 +++
> >  lib/efi_loader/efi_runtime.c      | 4 ++++
> >  lib/lmb.c                         | 4 +++-
> >  lib/time.c                        | 3 +++
> >  10 files changed, 33 insertions(+), 2 deletions(-)
> >
>
> You probably need to use:
>
> __declspec(selectany)
>
> to replace __weak in the ELF for the *nix world.
>
> Note this Microsoft bizarre does not provide the "strong override
> weak" effect but I suspect what you only need is to get the build pass
> on Windows so it should be okay.

With that I get:

lib/sha1.c:226:1: error: ‘selectany’ attribute applies only to
initialized variables with external linkage

and it dies.

The line is:

__weak void sha1_process(sha1_context *ctx, const unsigned char *data,
unsigned int blocks)

I tried adding a prototype to the header but got the same error.

Regards,
Simon


More information about the U-Boot mailing list