[PATCH v2 25/29] efi: Generate the app as a shared library

Tom Rini trini at konsulko.com
Mon Feb 10 15:50:13 CET 2025


On Sun, Feb 09, 2025 at 02:04:22PM -0700, Simon Glass wrote:
> Hi Tom,
> 
> On Sun, 9 Feb 2025 at 11:14, Tom Rini <trini at konsulko.com> wrote:
> >
> > On Sat, Feb 08, 2025 at 10:11:45AM -0700, Simon Glass wrote:
> >
> > > The app should be built as a shared library, with position-independent
> > > code and the -shared flags. Update the Makefile to handle this.
> > >
> > > Signed-off-by: Simon Glass <sjg at chromium.org>
> > > ---
> > >
> > > (no changes since v1)
> > >
> > >  Makefile | 4 ++++
> > >  1 file changed, 4 insertions(+)
> > >
> > > diff --git a/Makefile b/Makefile
> > > index f989c31073f..b3b13e29c26 100644
> > > --- a/Makefile
> > > +++ b/Makefile
> > > @@ -452,9 +452,13 @@ KBUILD_CFLAGS += $(call cc-option, -no-integrated-as)
> > >  KBUILD_AFLAGS += $(call cc-option, -no-integrated-as)
> > >  endif
> > >
> > > +ifdef CONFIG_EFI_APP
> > > +KBUILD_CFLAGS += -shared
> > > +else
> > >  # Don't generate position independent code
> > >  KBUILD_CFLAGS        += $(call cc-option,-fno-PIE)
> > >  KBUILD_AFLAGS        += $(call cc-option,-fno-PIE)
> > > +endif
> > >
> > >  # Read UBOOTRELEASE from include/config/uboot.release (if it exists)
> > >  UBOOTRELEASE = $(shell cat include/config/uboot.release 2> /dev/null)
> >
> > This should be tidied up with x86 being updated as well. In fact the
> > comment there isn't entirely useful as we still pass that with
> > CONFIG_POSITION_INDEPENDENT=y.
> 
> They are slightly different things.

Yes.

> POSITION_INDEPENDENT - controls how TEXT_BASE is figured out before relocaiton
> position-independent code - tells the compiler what to do. and we want
> this so we can relocate at the end of board_init_f()

All I'm saying is that the comment in the Makefile is wrong. We pass
-fno-PIE when building CONFIG_POSITION_INDEPENDENT=y.

> I can enable POSITION_INDEPENDENT in the ARM EFI app (like it is in
> x86, probably erroneously). Yes it gets rid of TEXT_BASE, but more as
> a side effect.
> 
> Perhaps POSITION_INDEPENDENT should be called POSITION_INDEPENDENT_F ?
> 
> Or perhaps it can have a dual meaning?

I confused things by commenting on the existing comment being wrong, no
need to try and overload the POSITION_INDEPENDENT symbol.

> > Setting flags should also likely be handled in board/efi/config.mk.
> 
> Oh yes, good idea.

Thanks.

-- 
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/20250210/b108fd34/attachment.sig>


More information about the U-Boot mailing list