From: Tom Rini <trini@konsulko.com>
To: u-boot@lists.denx.de
Subject: [PATCH u-boot v2 00/38] U-Boot LTO (Sandbox + Some ARM boards)
Date: Fri, 12 Mar 2021 10:33:02 -0500 [thread overview]
Message-ID: <20210312153302.GZ1310@bill-the-cat> (raw)
In-Reply-To: <adde1b9881d636cec789dc73c299339c9c58fdb3.camel@denx.de>
On Fri, Mar 12, 2021 at 04:26:54PM +0100, Harald Seiler wrote:
> On Fri, 2021-03-12 at 16:17 +0100, Pali Roh?r wrote:
> > On Friday 12 March 2021 16:07:22 Harald Seiler wrote:
> > > On Fri, 2021-03-12 at 15:26 +0100, Marek Behun wrote:
> > > > On Fri, 12 Mar 2021 15:21:05 +0100
> > > > Harald Seiler <hws@denx.de> wrote:
> > > >
> > > > > Hi Marek,
> > > > >
> > > > > On Fri, 2021-03-12 at 11:33 +0100, Marek Beh?n wrote:
> > > > > > Hello,
> > > > > >
> > > > > > I am sending version 2 of patches adding support for LTO to U-Boot.
> > > > > >
> > > > > > This series was tested by Github/Azure CI at
> > > > > > ??https://github.com/u-boot/u-boot/pull/57
> > > > > >
> > > > > > Code reduction is on average 4.23% for u-boot.bin and 13.58% for
> > > > > > u-boot-spl.bin.
> > > > > >
> > > > > > I am currently running a build test for all 1077 ARM defconfigs.
> > > > > > Of the first 232 defconfigs, 2 are failing when LTO is enabled
> > > > > > (chromebook_jerry and chromebook_speedy). Note that this series
> > > > > > only enables LTO for tested boards.
> > > > > >
> > > > > > Changes since v1:
> > > > > > - remove patches applied into u-boot-marvell
> > > > > > - added Reviewed-by tags
> > > > > > - addressed some issues discovered by Bin Meng, Marek Vasut,
> > > > > > ??Heinrich Schuchardt
> > > > > > - added more ARM boards (thanks to Adam Ford, Tim Harvey and Bin Meng)
> > > > > > - removed --gc-sections for ARM if internal libgcc is used
> > > > > > - remove -fwhole-program in final LTO LDFLAGS
> > > > > > - declared all 4 functions (memcpy, memset, memcmp, memmove) __used,
> > > > > > ??(these are mentioned in GCC man page for option -nodefaultlibs that
> > > > > > ???the compiler may generate; this seems to be a bug in GCC that linking
> > > > > > ???fails with LTO even if these functions are present, because the
> > > > > > ???symbols can be renamed on some targets by optimization)?
> > > > >
> > > > > I'm hitting a compiler error when building with imx6q_logic_defconfig:
> > > > >
> > > > > ? real-ld: error: no memory region specified for loadable section `.note.gnu.build-id'
> > > > >
> > > > > It seems this is caused by calling the linker through a gcc invocation
> > > > > which adds a `--build-id` commandline flag.? I think the linker script
> > > > > which is used for SPL in this case (arch/arm/mach-omap2/u-boot-spl.lds)
> > > > > isn't properly set up to deal with a build-id.
> > > > >
> > > > > I'm not sure how to deal with this.? One could either add
> > > > > `--build-id=none` to the GCC commandline to suppress generation of this
> > > > > section entirely (it is not emitted in non-LTO builds right now anyway) or
> > > > > include it in .text in said linker script so it is visible on the target.
> > > > > What do you think?
> > > > >
> > > > > I should note that I am using a Yocto-generated toolchain.? I suppose most
> > > > > standard toolchains' behavior regarding the `--build-id` flag probably
> > > > > differs.
> > > > >
> > > > > Regards,
> > > >
> > > > I encountered this with Debian's cross toolchain, but since this did
> > > > not happen on my station with Gentoo crossdev toolchain, nor on Azure
> > > > CI, I ignored it.
> > > >
> > > > What is the purpose of --build-id? Why do people use it?
> > >
> > > I'm not entirely sure but I think it acts as a unique identifier for
> > > a certain binary.? So you can match up a core-dump with its debug info for
> > > example.
> > >
> > > But I am unsure if anyone in the firmware space is actively using this
> > > feature... At least U-Boot does not actually include the build-id on the
> > > target - it is not generated for SPL at all and U-Boot proper only
> > > contains it in the ELF file, it is not exported into the raw binary.
> >
> > IIRC Debian is using build id to split out debug symbols to external ELF
> > binary. So based on build id it can correctly identify which external
> > ELF file contains correct debug symbols for stripped ELF binary. IIRC
> > gdb in Debian can locale external ELF file with debug symbols from
> > well-known location, so you just need to install appropriate -dbg
> > package and gdb automatically loads debug symbols.
> >
> > But if you want to use build id for any purpose, you need some binary
> > "container" where you can store metadata (EXE, ELF, ...). So I think
> > build id would be normally stripped from RAW u-boot.bin binary.
> >
> > But if you really want to use build id in U-Boot, what about following
> > idea? Put build id into some U-Boot global variable and add some U-Boot
> > command which can print it in U-Boot console. And then based on it you
> > can locale u-boot ELF binary on your disk (if you have not removed it)
> > and you can start e.g. debugging or other things.
> >
> > In this case build id can be useful for unique identification of the
> > built binary.
>
> For the record, I don't care much, I just noticed the compiler error and
> wanted to raise awareness.
>
> But yeah, it might be useful indeed. I found a blog-post [1] of someone
> else doing exactly this, by just adding
>
> PROVIDE(g_note_build_id = .);
> *(.note.gnu.build-id)
>
> to the linker script and then referencing `g_note_build_id` somewhere to
> display it.
>
> But either way I think this only really matters if you have a
> hardware-debugger and intend to debug U-Boot with it.
It looks like in Linux they do --build-id=sha1 and then use it in panic
messages, from a quick skim.
For the LTO series, a work-around of --build-id=none is probably fine,
but it would be good to work putting the ID in to some existing and
relevant would be good. Perhaps just the "version" command ?
--
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/20210312/e64de870/attachment.sig>
prev parent reply other threads:[~2021-03-12 15:33 UTC|newest]
Thread overview: 58+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-03-12 10:33 [PATCH u-boot v2 00/38] U-Boot LTO (Sandbox + Some ARM boards) Marek Behún
2021-03-12 10:33 ` [PATCH u-boot v2 01/38] regmap: fix a serious pointer casting bug Marek Behún
2021-03-12 10:33 ` [PATCH u-boot v2 02/38] api: fix a potential serious bug caused by undef CONFIG_SYS_64BIT_LBA Marek Behún
2021-03-12 10:33 ` [PATCH u-boot v2 03/38] checkpatch: require quotes around section name in the __section() macro Marek Behún
2021-03-12 10:33 ` [PATCH u-boot v2 04/38] treewide: Convert macro and uses of __section(foo) to __section("foo") Marek Behún
2021-03-12 10:33 ` [PATCH u-boot v2 05/38] compiler.h: align the __ADDRESSABLE macro with Linux' version Marek Behún
2021-03-12 10:33 ` [PATCH u-boot v2 06/38] linker_lists: prepare macros to avoid code repetition Marek Behún
2021-03-12 10:33 ` [PATCH u-boot v2 07/38] test/py: improve regular expression for ut subtest symbol matcher Marek Behún
2021-03-12 10:33 ` [PATCH u-boot v2 08/38] linker_lists: declare lists and entries as __ADDRESSABLE for LTO Marek Behún
2021-03-12 10:34 ` [PATCH u-boot v2 09/38] string: make memcpy(), memset(), memcmp() and memmove() visible " Marek Behún
2021-03-12 10:34 ` [PATCH u-boot v2 10/38] efi_loader: fix warning when linking with LTO Marek Behún
2021-03-12 16:42 ` Heinrich Schuchardt
2021-03-15 22:34 ` Marek Behun
2021-03-12 10:34 ` [PATCH u-boot v2 11/38] efi_loader: add Sphinx doc for __efi_runtime and __efi_runtime_data Marek Behún
2021-03-12 16:45 ` Heinrich Schuchardt
2021-03-12 10:34 ` [PATCH u-boot v2 12/38] efi_loader: add macro for const EFI runtime data Marek Behún
2021-03-12 16:47 ` Heinrich Schuchardt
2021-03-12 10:34 ` [PATCH u-boot v2 13/38] efi_selftest: compiler flags for efi_selftest_miniapp_exception.o Marek Behún
2021-03-12 16:49 ` Heinrich Schuchardt
2021-03-12 10:34 ` [PATCH u-boot v2 14/38] lib: crc32: put the crc_table variable into efi_runtime_rodata section Marek Behún
2021-03-12 16:51 ` Heinrich Schuchardt
2021-03-12 10:34 ` [PATCH u-boot v2 15/38] Makefile, Makefile.spl: cosmetic change Marek Behún
2021-03-12 10:34 ` [PATCH u-boot v2 16/38] build: use thin archives instead of incremental linking Marek Behún
2021-03-12 10:34 ` [PATCH u-boot v2 17/38] build: support building with Link Time Optimizations Marek Behún
2021-03-12 10:34 ` [PATCH u-boot v2 18/38] sandbox: errno: avoid conflict with libc's errno Marek Behún
2021-03-12 10:34 ` [PATCH u-boot v2 19/38] sandbox: use sections instead of symbols for getopt array boundaries Marek Behún
2021-03-12 10:34 ` [PATCH u-boot v2 20/38] sandbox: make LTO available Marek Behún
2021-03-12 10:34 ` [PATCH u-boot v2 21/38] sandbox: enable LTO by default Marek Behún
2021-03-12 10:34 ` [PATCH u-boot v2 22/38] ARM: global_data: make set_gd() work for armv5 and armv6 Marek Behún
2021-03-12 10:34 ` [PATCH u-boot v2 23/38] ARM: make gd a function call for LTO and set via set_gd() Marek Behún
2021-03-12 10:34 ` [PATCH u-boot v2 24/38] ARM: fix LTO build for some thumb-interwork cases Marek Behún
2021-03-12 10:34 ` [PATCH u-boot v2 25/38] ARM: fix LTO for imx28_xea Marek Behún
2021-03-12 10:34 ` [PATCH u-boot v2 26/38] ARM: fix LTO for apf27 Marek Behún
2021-03-12 10:34 ` [PATCH u-boot v2 27/38] ARM: fix LTO for keystone Marek Behún
2021-03-12 10:34 ` [PATCH u-boot v2 28/38] ARM: kona: fix clk_bsc_enable() type mismatch for LTO Marek Behún
2021-03-12 10:34 ` [PATCH u-boot v2 29/38] ARM: imx8m: fix imx_eqos_txclk_set_rate() " Marek Behún
2021-03-12 10:34 ` [PATCH u-boot v2 30/38] ARM: fix LTO for seaboard Marek Behún
2021-03-12 10:34 ` [PATCH u-boot v2 31/38] ARM: fix LTO for rockchip and samsung Marek Behún
2021-03-12 10:34 ` [PATCH u-boot v2 32/38] ARM: omap3: fix LTO for DM3730 (and possibly other omap3 boards) Marek Behún
2021-03-12 13:43 ` Adam Ford
2021-03-13 15:23 ` Adam Ford
2021-03-13 16:05 ` Marek Behun
2021-03-13 17:34 ` Adam Ford
2021-03-12 10:34 ` [PATCH u-boot v2 33/38] armv8: SPL: discard relocation information Marek Behún
2021-03-12 10:34 ` [PATCH u-boot v2 34/38] ata: ahci: fix ahci_link_up() type mismatch for LTO Marek Behún
2021-03-12 10:34 ` [PATCH u-boot v2 35/38] ARM: make LTO available Marek Behún
2021-03-12 10:34 ` [PATCH u-boot v2 36/38] ARM: don't use -ffunction-sections/-fdata-sections with LTO build Marek Behún
2021-03-12 10:34 ` [PATCH u-boot v2 37/38] ARM: don't use --gc-sections with LTO when using private libgcc Marek Behún
2021-03-12 10:34 ` [PATCH u-boot v2 38/38] ARM: enable LTO for some boards Marek Behún
2021-03-12 14:21 ` [PATCH u-boot v2 00/38] U-Boot LTO (Sandbox + Some ARM boards) Harald Seiler
2021-03-12 14:26 ` Marek Behun
2021-03-12 15:07 ` Harald Seiler
2021-03-12 15:11 ` Harald Seiler
2021-03-12 15:18 ` Marek Behun
2021-03-12 15:17 ` Pali Rohár
2021-03-12 15:26 ` Harald Seiler
2021-03-12 15:32 ` Pali Rohár
2021-03-12 15:33 ` Tom Rini [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210312153302.GZ1310@bill-the-cat \
--to=trini@konsulko.com \
--cc=u-boot@lists.denx.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox