From: Tom Rini <trini@konsulko.com>
To: u-boot@lists.denx.de
Subject: [PATCH u-boot 37/39] ARM: don't use -ffunction-sections/-fdata-sections with LTO build
Date: Fri, 12 Mar 2021 08:52:04 -0500 [thread overview]
Message-ID: <20210312135204.GV1310@bill-the-cat> (raw)
In-Reply-To: <20210312144419.0623f76b@nic.cz>
On Fri, Mar 12, 2021 at 02:44:19PM +0100, Marek Behun wrote:
> On Fri, 12 Mar 2021 08:18:44 -0500
> Tom Rini <trini@konsulko.com> wrote:
>
> > On Fri, Mar 12, 2021 at 08:29:05AM +0100, Marek Behun wrote:
> > > On Fri, 12 Mar 2021 15:19:26 +0800
> > > Bin Meng <bmeng.cn@gmail.com> wrote:
> > >
> > > > On Fri, Mar 12, 2021 at 3:11 PM Marek Behun <marek.behun@nic.cz> wrote:
> > > > >
> > > > > On Fri, 12 Mar 2021 14:48:04 +0800
> > > > > Bin Meng <bmeng.cn@gmail.com> wrote:
> > > > >
> > > > > > On Fri, Mar 12, 2021 at 2:45 PM Marek Behun <marek.behun@nic.cz> wrote:
> > > > > > >
> > > > > > > On Wed, 10 Mar 2021 11:40:42 +0800
> > > > > > > Bin Meng <bmeng.cn@gmail.com> wrote:
> > > > > > >
> > > > > > > > On Sun, Mar 7, 2021 at 12:26 PM Marek Beh?n <marek.behun@nic.cz> wrote:
> > > > > > > > >
> > > > > > > > > When building with LTO, using -ffunction-sections/-fdata-sections is not
> > > > > > > > > useful anymore.
> > > > > > > > >
> > > > > > > > > Signed-off-by: Marek Beh?n <marek.behun@nic.cz>
> > > > > > > > > ---
> > > > > > > > > arch/arm/config.mk | 8 ++++++--
> > > > > > > > > 1 file changed, 6 insertions(+), 2 deletions(-)
> > > > > > > > >
> > > > > > > >
> > > > > > > > I believe we should also remove --gc-sections.
> > > > > > >
> > > > > > > It seems that --gc-sections cannot be removed, otherwise some builds,
> > > > > > > for example turris_mox_defconfig, fail with
> > > > > > >
> > > > > > > LTO u-boot
> > > > > > > /usr/libexec/gcc/aarch64-unknown-linux-gnu/ld: /usr/lib/gcc/aarch64-unknown-linux-gnu/10.2.0/libgcc.a(lse-init.o): in function `init_have_lse_atomics':
> > > > > > > /var/tmp/portage/cross-aarch64-unknown-linux-gnu/gcc-10.2.0-r5/work/gcc-10.2.0/libgcc/config/aarch64/lse-init.c:44: undefined reference to `__getauxval'
> > > > > > > /usr/libexec/gcc/aarch64-unknown-linux-gnu/ld: /usr/lib/gcc/aarch64-unknown-linux-gnu/10.2.0/libgcc.a(_absvsi2.o): in function `__absvdi2':
> > > > > > > /var/tmp/portage/cross-aarch64-unknown-linux-gnu/gcc-10.2.0-r5/work/gcc-10.2.0/libgcc/libgcc2.c:228: undefined reference to `abort'
> > > > > > > /usr/libexec/gcc/aarch64-unknown-linux-gnu/ld: /usr/lib/gcc/aarch64-unknown-linux-gnu/10.2.0/libgcc.a(_absvsi2.o): in function `__absvsi2':
> > > > > > > /var/tmp/portage/cross-aarch64-unknown-linux-gnu/gcc-10.2.0-r5/work/gcc-10.2.0/libgcc/libgcc2.c:246: undefined reference to `abort'
> > > > > > > /usr/libexec/gcc/aarch64-unknown-linux-gnu/ld: /usr/lib/gcc/aarch64-unknown-linux-gnu/10.2.0/libgcc.a(_absvdi2.o): in function `__absvti2':
> > > > > > > /var/tmp/portage/cross-aarch64-unknown-linux-gnu/gcc-10.2.0-r5/work/gcc-10.2.0/libgcc/libgcc2.c:267: undefined reference to `abort'
> > > > > > > /usr/libexec/gcc/aarch64-unknown-linux-gnu/ld: /usr/lib/gcc/aarch64-unknown-linux-gnu/10.2.0/libgcc.a(_addvsi3.o): in function `__addvdi3':
> > > > > > > /var/tmp/portage/cross-aarch64-unknown-linux-gnu/gcc-10.2.0-r5/work/gcc-10.2.0/libgcc/libgcc2.c:81: undefined reference to `abort'
> > > > > > > /usr/libexec/gcc/aarch64-unknown-linux-gnu/ld: /usr/lib/gcc/aarch64-unknown-linux-gnu/10.2.0/libgcc.a(_addvsi3.o): in function `__addvsi3':
> > > > > > > /var/tmp/portage/cross-aarch64-unknown-linux-gnu/gcc-10.2.0-r5/work/gcc-10.2.0/libgcc/libgcc2.c:92: undefined reference to `abort'
> > > > > > > /usr/libexec/gcc/aarch64-unknown-linux-gnu/ld: /usr/lib/gcc/aarch64-unknown-linux-gnu/10.2.0/libgcc.a(_addvdi3.o):/var/tmp/portage/cross-aarch64-unknown-linux-gnu/gcc-10.2.0-r5/work/gcc-10.2.0/libgcc/libgcc2.c:106: more undefined references to `abort' follow
> > > > > > > /usr/libexec/gcc/aarch64-unknown-linux-gnu/ld: /usr/lib/gcc/aarch64-unknown-linux-gnu/10.2.0/libgcc.a(_eprintf.o): in function `__eprintf':
> > > > > > > /var/tmp/portage/cross-aarch64-unknown-linux-gnu/gcc-10.2.0-r5/work/gcc-10.2.0/libgcc/libgcc2.c:2152: undefined reference to `stderr'
> > > > > > > /usr/libexec/gcc/aarch64-unknown-linux-gnu/ld: /var/tmp/portage/cross-aarch64-unknown-linux-gnu/gcc-10.2.0-r5/work/gcc-10.2.0/libgcc/libgcc2.c:2152: undefined reference to `stderr'
> > > > > > > /usr/libexec/gcc/aarch64-unknown-linux-gnu/ld: /usr/lib/gcc/aarch64-unknown-linux-gnu/10.2.0/libgcc.a(_eprintf.o): in function `fprintf':
> > > > > > > /usr/aarch64-unknown-linux-gnu/sys-include/bits/stdio2.h:103: undefined reference to `__fprintf_chk'
> > > > > > > /usr/libexec/gcc/aarch64-unknown-linux-gnu/ld: /usr/lib/gcc/aarch64-unknown-linux-gnu/10.2.0/libgcc.a(_eprintf.o): in function `__eprintf':
> > > > > > > /var/tmp/portage/cross-aarch64-unknown-linux-gnu/gcc-10.2.0-r5/work/gcc-10.2.0/libgcc/libgcc2.c:2153: undefined reference to `fflush'
> > > > > > > /usr/libexec/gcc/aarch64-unknown-linux-gnu/ld: /var/tmp/portage/cross-aarch64-unknown-linux-gnu/gcc-10.2.0-r5/work/gcc-10.2.0/libgcc/libgcc2.c:2154: undefined reference to `abort'
> > > > > >
> > > > > > Ouch! How compiler behaves when it comes to LTO and works with all
> > > > > > these compiler/linker options is really a mystery ...
> > > > >
> > > > > OK, it seems that on aarch64 we are actually using system's libgcc :)
> > > >
> > > > Thanks.
> > > >
> > > > > Not the internal one. So it seems we need --gc-sections to throw away
> > > > > garbade that is not used.
> > > >
> > > > Needed only when CONFIG_USE_PRIVATE_LIBGCC is off?
> > >
> > > Seems that way.
> >
> > Well, _and_ we need libgcc for anything too. A quick set of hacks:
> > diff --git a/Makefile b/Makefile
> > index d6eda45385c3..af3e03ac9fa0 100644
> > --- a/Makefile
> > +++ b/Makefile
> > @@ -830,8 +830,6 @@ u-boot-main := $(libs-y)
> > # Add GCC lib
> > ifeq ($(CONFIG_USE_PRIVATE_LIBGCC),y)
> > PLATFORM_LIBGCC = arch/$(ARCH)/lib/lib.a
> > -else
> > -PLATFORM_LIBGCC := -L $(shell dirname `$(CC) $(c_flags) -print-libgcc-file-name`) -lgcc
> > endif
> > PLATFORM_LIBS += $(PLATFORM_LIBGCC)
> >
> > Shows that turris_mox links just fine without the main gcc, because I
> > probably misunderstood something a bit ages back when dealing with the
> > libgcc fun we have. So I'm gonna see if that hack above is actually
> > just correct for all the other cases.
> >
>
> It depends on whether arch/arm/lib provides all necessary functions for
> aarch64 as well. lib1funcs.S implements stuff only for 32bit arm.
>
> But looking at libgcc for aarch64, it does not seem that it contains
> things that may be needed for u-boot. Maybe floating point operations
> with -fsoft-float, but I guess nobody uses this in U-Boot.
>
> Although recently I was working on driver for Armada 3720 UART baudrate
> generator, and the computation may need floating point operations
> to compute best prescaler parameters. But if we limit ourselves to a
> predefined set of available baudrates, we can just prepare a table with
> the needed parameters.
Right, so we have to things related to floating point right. I think
the high level problem/answer is hat on 32bit ARM we followed in the
Linux kernel's footsteps and so we have lib1funcs, etc. We don't do
what I think of as actual floating point math (ie float foo), but
whatever we can do in shifts we do.
--
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/4db65cc6/attachment.sig>
next prev parent reply other threads:[~2021-03-12 13:52 UTC|newest]
Thread overview: 139+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-03-07 4:24 [PATCH u-boot 00/39] U-Boot LTO (Sandbox + Some ARM boards) Marek Behún
2021-03-07 4:25 ` [PATCH u-boot-marvell 01/39] ddr: marvell: axp: align signature of mv_xor_mem_init() with a38x Marek Behún
2021-03-08 6:50 ` Bin Meng
2021-03-07 4:25 ` [PATCH u-boot-marvell 02/39] ddr: marvell: axp: fix array types have different bounds warning Marek Behún
2021-03-08 6:41 ` Stefan Roese
2021-03-08 6:45 ` Marek Behun
2021-03-08 6:50 ` Stefan Roese
2021-03-09 13:54 ` Tom Rini
2021-03-12 8:54 ` Stefan Roese
2021-03-08 6:46 ` Marek Behun
2021-03-08 6:58 ` Stefan Roese
2021-03-08 7:04 ` Marek Behun
2021-03-08 6:50 ` Bin Meng
2021-03-07 4:25 ` [PATCH u-boot-dm 03/39] regmap: fix a serious pointer casting bug Marek Behún
2021-03-08 7:10 ` Bin Meng
2021-03-07 4:25 ` [PATCH u-boot 04/39] api: fix a potential serious bug caused by undef CONFIG_SYS_64BIT_LBA Marek Behún
2021-03-08 7:09 ` Bin Meng
2021-03-08 7:21 ` Marek Behun
2021-03-07 4:25 ` [PATCH u-boot 05/39] checkpatch: require quotes around section name in the __section() macro Marek Behún
2021-03-07 4:47 ` Marek Vasut
2021-03-07 4:55 ` Marek Behun
2021-03-07 4:25 ` [PATCH u-boot 06/39] treewide: Convert macro and uses of __section(foo) to __section("foo") Marek Behún
2021-03-08 7:27 ` Bin Meng
2021-03-07 4:25 ` [PATCH u-boot 07/39] compiler.h: align the __ADDRESSABLE macro with Linux' version Marek Behún
2021-03-08 7:27 ` Bin Meng
2021-03-08 9:23 ` Marek Behun
2021-03-08 10:29 ` Bin Meng
2021-03-08 11:04 ` Marek Behun
2021-03-07 4:25 ` [PATCH u-boot 08/39] linker_lists: prepare macros to avoid code repetition Marek Behún
2021-03-08 7:44 ` Bin Meng
2021-03-07 4:25 ` [PATCH u-boot 09/39] test/py: improve regular expression for ut subtest symbol matcher Marek Behún
2021-03-07 4:25 ` [PATCH u-boot 10/39] linker_lists: declare lists and entries as __ADDRESSABLE for LTO Marek Behún
2021-03-08 7:44 ` Bin Meng
2021-03-07 4:25 ` [PATCH u-boot 11/39] binman: declare symbols externally visible Marek Behún
2021-03-07 4:59 ` Marek Behun
2021-03-08 7:47 ` Bin Meng
2021-03-08 9:26 ` Marek Behun
2021-03-08 10:31 ` Bin Meng
2021-03-08 11:07 ` Marek Behun
2021-03-07 4:25 ` [PATCH u-boot 12/39] string: make memcpy() and memset() visible to fix LTO linking errors Marek Behún
2021-03-08 7:56 ` Bin Meng
2021-03-08 10:19 ` Marek Behun
2021-03-08 10:23 ` Pali Rohár
2021-03-08 10:40 ` Bin Meng
2021-03-08 10:55 ` Pali Rohár
2021-03-08 11:31 ` Marek Behun
2021-03-08 11:36 ` Marek Behun
2021-03-12 10:09 ` Marek Behun
2021-03-12 11:11 ` Bin Meng
2021-03-07 4:25 ` [PATCH u-boot 13/39] efi_loader: fix warning when linking with LTO Marek Behún
2021-03-08 7:56 ` Bin Meng
2021-03-07 4:25 ` [PATCH u-boot 14/39] lib: crc32: make the crc_table variable non-const Marek Behún
2021-03-07 4:46 ` Marek Vasut
2021-03-07 4:58 ` Marek Behun
2021-03-07 5:02 ` Marek Vasut
2021-03-07 12:26 ` Marek Behun
2021-03-07 12:31 ` Pali Rohár
2021-03-07 12:42 ` Marek Behun
2021-03-07 12:52 ` [PATCH u-boot 14/39] lib: crc32: put the crc_table variable into efi_runtime_rodata section Marek Behún
2021-03-07 13:04 ` Marek Behun
2021-03-07 20:49 ` Marek Behun
2021-03-08 7:01 ` [PATCH u-boot v1.1 14.1/39] efi_loader: add macro for const EFI runtime data Marek Behún
2021-03-08 7:36 ` Heinrich Schuchardt
2021-03-08 9:54 ` [PATCH u-boot v1.2 14.1/39] efi_loader: add Sphinx doc for __efi_runtime and __efi_runtime_data Marek Behún
2021-03-08 9:54 ` [PATCH u-boot v1.2 14.2/39] efi_loader: add macro for const EFI runtime data Marek Behún
2021-03-08 9:54 ` [PATCH u-boot v1.2 14.3/39] lib: crc32: put the crc_table variable into efi_runtime_rodata section Marek Behún
2021-03-08 7:01 ` [PATCH u-boot v1.1 14.2/39] " Marek Behún
2021-03-08 8:43 ` Marek Vasut
2021-03-07 4:25 ` [PATCH u-boot 15/39] Makefile, Makefile.spl: cosmetic change Marek Behún
2021-03-08 9:11 ` Bin Meng
2021-03-08 10:12 ` [PATCH u-boot v1.1 " Marek Behún
2021-03-08 10:42 ` Bin Meng
2021-03-07 4:25 ` [PATCH u-boot 16/39] build: use thin archives instead of incremental linking Marek Behún
2021-03-08 9:16 ` Bin Meng
2021-03-08 10:11 ` Marek Behun
2021-03-08 10:44 ` Bin Meng
2021-03-08 11:00 ` Pali Rohár
2021-03-08 11:41 ` Bin Meng
2021-03-08 11:18 ` Marek Behun
2021-03-08 11:32 ` Bin Meng
2021-03-08 11:52 ` Marek Behun
2021-03-08 13:24 ` Marek Behún
2021-03-08 14:30 ` Bin Meng
2021-03-08 15:22 ` Marek Behún
2021-03-09 1:24 ` Bin Meng
2021-03-09 3:42 ` Bin Meng
2021-03-09 10:36 ` Marek Behun
2021-03-09 13:00 ` Bin Meng
2021-03-11 12:42 ` Marek Behun
2021-03-07 4:25 ` [PATCH u-boot 17/39] build: support building with Link Time Optimizations Marek Behún
2021-03-09 13:30 ` Bin Meng
2021-03-11 12:45 ` Marek Behun
2021-03-07 4:25 ` [PATCH u-boot 18/39] build: LTO: move platform libs into --start-group list Marek Behún
2021-03-09 15:24 ` Bin Meng
2021-03-11 19:41 ` Marek Behun
2021-03-07 4:25 ` [PATCH u-boot 19/39] sandbox: errno: avoid conflict with libc's errno Marek Behún
2021-03-09 15:28 ` Bin Meng
2021-03-07 4:25 ` [PATCH u-boot 20/39] sandbox: use sections instead of symbols for getopt array boundaries Marek Behún
2021-03-07 4:25 ` [PATCH u-boot 21/39] sandbox: make LTO available Marek Behún
2021-03-10 5:36 ` Bin Meng
2021-03-07 4:25 ` [PATCH u-boot 22/39] sandbox: enable LTO by default Marek Behún
2021-03-10 5:33 ` Bin Meng
2021-03-07 4:25 ` [PATCH u-boot 23/39] ARM: global_data: make set_gd() work for armv5 and armv6 Marek Behún
2021-03-07 4:25 ` [PATCH u-boot 24/39] ARM: make gd a function call for LTO and set via set_gd() Marek Behún
2021-03-07 4:25 ` [PATCH u-boot 25/39] ARM: fix LTO build for some thumb-interwork cases Marek Behún
2021-03-07 4:25 ` [PATCH u-boot 26/39] ARM: fix LTO for imx28_xea Marek Behún
2021-03-10 5:31 ` Bin Meng
2021-03-07 4:25 ` [PATCH u-boot 27/39] ARM: fix LTO for apf27 Marek Behún
2021-03-07 4:25 ` [PATCH u-boot 28/39] ARM: fix LTO for keystone Marek Behún
2021-03-07 4:25 ` [PATCH u-boot 29/39] ARM: kona: fix clk_bsc_enable() type mismatch for LTO Marek Behún
2021-03-10 5:29 ` Bin Meng
2021-03-07 4:25 ` [PATCH u-boot 30/39] ARM: imx6m: fix imx_eqos_txclk_set_rate() " Marek Behún
2021-03-07 5:33 ` Sean Anderson
2021-03-07 12:13 ` Marek Behun
2021-03-10 5:27 ` Bin Meng
2021-03-07 4:25 ` [PATCH u-boot 31/39] ARM: fix LTO for seaboard Marek Behún
2021-03-07 4:25 ` [PATCH u-boot 32/39] ARM: fix LTO for rockchip and samsung Marek Behún
2021-03-10 5:25 ` Bin Meng
2021-03-07 4:25 ` [PATCH u-boot 33/39] ARM: omap3: fix LTO for DM3730 (and possibly other omap3 boards) Marek Behún
2021-03-07 10:40 ` Adam Ford
2021-03-07 4:25 ` [PATCH u-boot 34/39] armv8: SPL: discard relocation information Marek Behún
2021-03-07 4:25 ` [PATCH u-boot 35/39] ata: ahci: fix ahci_link_up() type mismatch for LTO Marek Behún
2021-03-10 5:23 ` Bin Meng
2021-03-07 4:25 ` [PATCH u-boot 36/39] ARM: make LTO available Marek Behún
2021-03-07 4:25 ` [PATCH u-boot 37/39] ARM: don't use -ffunction-sections/-fdata-sections with LTO build Marek Behún
2021-03-10 3:40 ` Bin Meng
2021-03-12 6:45 ` Marek Behun
2021-03-12 6:48 ` Bin Meng
2021-03-12 7:00 ` Marek Behun
2021-03-12 7:11 ` Marek Behun
2021-03-12 7:19 ` Bin Meng
2021-03-12 7:29 ` Marek Behun
2021-03-12 13:18 ` Tom Rini
2021-03-12 13:44 ` Marek Behun
2021-03-12 13:52 ` Tom Rini [this message]
2021-03-07 4:25 ` [PATCH u-boot 38/39] ARM: enable LTO for some boards Marek Behún
2021-03-07 16:14 ` Adam Ford
2021-03-07 20:49 ` Marek Behun
2021-03-07 4:25 ` [PATCH u-boot 39/39] DO NOT MERGE! ARM: enable LTO by default Marek Behún
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=20210312135204.GV1310@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