Question: LTO and failing objcopy in "u-boot-initial-env" target

Tom Rini trini at konsulko.com
Sat Oct 23 19:25:54 CEST 2021


On Fri, Oct 22, 2021 at 02:49:17PM -0500, Adam Ford wrote:
> On Fri, Oct 22, 2021 at 2:26 PM Marek Behún <marek.behun at nic.cz> wrote:
> >
> > On Fri, 22 Oct 2021 14:19:16 -0500
> > Adam Ford <aford173 at gmail.com> wrote:
> >
> > > I am not sure it's the right solution, but it appears to work for me
> > > on a board that uses LTO.  I didn't try it with a board that doesn't
> > > use LTO.
> >
> > Need to be tested with GCC as well as Clang.
> 
> Agreed.
> 
> I turned off LTO, and got an error, so I updated the diff to:
> 
> 
> diff --git a/Makefile b/Makefile
> index 5194e4dc78..386180e935 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -2303,7 +2303,7 @@ endif
>         $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modpost
> 
>  quiet_cmd_genenv = GENENV  $@
> -cmd_genenv = $(OBJCOPY) --dump-section .rodata.default_environment=$@
> env/common.o; \
> +cmd_genenv = $(OBJCOPY) --dump-section `${OBJDUMP} env/common.o -t
> |grep -m1 default_environment |awk '{print $$4}'`=$@ env/common.o; \
>         sed --in-place -e 's/\x00/\x0A/g' $@
> 
>  u-boot-initial-env: u-boot.bin
> 
> 
> It now appears to build without error with LTO enabled and disabled.

I think LLVM is just not supportable without a different set of logic,
as env/common.o just isn't quite the same (with LTO it's an IR file,
without it's an object, but doesn't quite have that section?).

-- 
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/20211023/61c33f69/attachment.sig>


More information about the U-Boot mailing list