All of lore.kernel.org
 help / color / mirror / Atom feed
* [RFC PATCH u-boot 00/12] U-Boot LTO (Sandbox + ARM Nokia RX-51)
@ 2021-03-03  4:11 Marek Behún
  2021-03-03  4:12 ` [RFC PATCH u-boot 01/12] build: use thin archives instead of incremental linking Marek Behún
                   ` (12 more replies)
  0 siblings, 13 replies; 75+ messages in thread
From: Marek Behún @ 2021-03-03  4:11 UTC (permalink / raw)
  To: u-boot

Hello,

I have managed to add support for building U-Boot with LTO (with GCC)
in a rather sane way (in LOC changed).

This series and its follows will also be available at
https://github.com/elkablo/u-boot branch lto.

I have tested these builds on Turris Omnia, Turris MOX and on Nokia N900
(via the test/nokia_rx51_test.sh script). For other tests I have created
a pull-request on github to trigger CI (https://github.com/u-boot/u-boot/pull/57)
For some reason it is waiting now, maybe Azure is not working or
something.

My tests on Omnia and MOX show that U-Boot boots sucessfully, and basic
commands seem to work. But of course something broken due to LTO may be
found later.

So for all of you that are interested and have an ARM board, please test
this on your boards by enabling CONFIG_LTO option. Also please report
code size reductions. (Chris Packham reports an error related to
jobserver, so if `make -jN` produces an error, please try without the
`-jN` flag.)

I have only tested with gcc-10. There are still some warnings printed,
like:
  bfd plugin: invalid symbol type found
but these don't seem to matter. I will look into this later.

Here are some results by how much code size reduced. Note that SPL
binary seems to gain more code reduction (15.4 % on average) than main
binary (4.5 % on average).

I guess this is because of how drivers are written. The optimizer cannot
know which code paths won't be used, since it does not see the device
tree. Maybe this could be somehow integrated with Simon's work on
OF_PLATDATA_INST in the future, to make the compiler optimize out unused
code paths in drivers by understanding the device tree.

                        u-boot.bin       u-boot-spl.bin

         clearfog    4.34 %  19.0 KB    13.55 %  16.8 KB
  controlcenterdc    4.79 %  24.2 KB    16.27 %  21.9 KB
   db-88f6820-amc    4.23 %  25.0 KB    16.17 %  22.9 KB
    db-88f6820-gp    4.42 %  22.1 KB    17.00 %  23.8 KB
          helios4    4.32 %  18.9 KB    13.70 %  16.8 KB
       nokia_rx51    6.11 %  16.5 KB
       turris_mox    4.17 %  31.8 KB
     turris_omnia    4.32 %  30.2 KB    14.91 %  16.6 KB
             x530    3.93 %  30.0 KB    16.26 %  23.4 KB

Marek

Marek Beh?n (12):
  build: use thin archives instead of incremental linking
  sandbox: errno: avoid conflict with libc's errno
  linker_lists: declare entries and lists externally visible
  efi_loader: fix warning when linking with LTO
  binman: declare symbols externally visible
  build: support building with Link Time Optimizations
  arch: sandbox: make LTO available
  sandbox: build with LTO
  ARM: make gd a function for LTO
  string: make memcpy() visible to fix LTO linking errors
  arch: ARM: make LTO available
  Nokia RX-51: build with LTO

 Kbuild                             |  2 ++
 Kconfig                            | 19 +++++++++++++++++++
 Makefile                           | 28 +++++++++++++++++++++++++++-
 arch/Kconfig                       |  2 ++
 arch/arm/include/asm/global_data.h |  2 +-
 arch/arm/lib/Makefile              |  2 ++
 arch/sandbox/config.mk             | 10 +++++-----
 configs/nokia_rx51_defconfig       |  1 +
 configs/sandbox64_defconfig        |  1 +
 configs/sandbox_defconfig          |  1 +
 configs/sandbox_flattree_defconfig |  1 +
 configs/sandbox_spl_defconfig      |  1 +
 include/binman.h                   |  1 +
 include/binman_sym.h               |  4 ++--
 include/efi_loader.h               |  4 ++--
 include/errno.h                    |  8 +++++++-
 include/linker_lists.h             |  6 ++++--
 lib/efi_loader/Makefile            |  2 +-
 lib/errno.c                        |  4 +++-
 lib/string.c                       |  3 ++-
 scripts/Makefile.build             |  5 ++---
 scripts/Makefile.lib               |  3 +++
 scripts/Makefile.spl               | 20 ++++++++++++++++----
 23 files changed, 106 insertions(+), 24 deletions(-)

-- 
2.26.2

^ permalink raw reply	[flat|nested] 75+ messages in thread

end of thread, other threads:[~2021-05-13  9:22 UTC | newest]

Thread overview: 75+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-03  4:11 [RFC PATCH u-boot 00/12] U-Boot LTO (Sandbox + ARM Nokia RX-51) Marek Behún
2021-03-03  4:12 ` [RFC PATCH u-boot 01/12] build: use thin archives instead of incremental linking Marek Behún
2021-03-04 10:57   ` Bin Meng
2021-03-04 18:17     ` Marek Behun
2021-03-05 13:34       ` Bin Meng
2021-03-05 13:37         ` Tom Rini
2021-03-06 21:20           ` Marek Behun
2021-03-05 15:39         ` Marek Behun
2021-03-03  4:12 ` [RFC PATCH u-boot 02/12] sandbox: errno: avoid conflict with libc's errno Marek Behún
2021-03-05  3:00   ` Bin Meng
2021-03-05 15:37     ` Marek Behun
2021-03-05 16:39       ` Simon Glass
2021-03-05 16:50         ` Marek Behun
2021-03-05 16:58           ` Simon Glass
2021-03-05 17:24             ` Heinrich Schuchardt
2021-03-05 17:24             ` Marek Behun
2021-03-05 19:42               ` Simon Glass
2021-03-05 17:21       ` Heinrich Schuchardt
2021-03-07  3:14         ` Marek Behun
2021-03-12  4:45   ` Simon Glass
2021-03-03  4:12 ` [RFC PATCH u-boot 03/12] linker_lists: declare entries and lists externally visible Marek Behún
2021-03-04 13:47   ` Marek Behun
2021-03-05  3:04   ` Bin Meng
2021-03-05 15:49     ` Marek Behun
2021-03-03  4:12 ` [RFC PATCH u-boot 04/12] efi_loader: fix warning when linking with LTO Marek Behún
2021-03-05  5:50   ` Bin Meng
2021-03-03  4:12 ` [RFC PATCH u-boot 05/12] binman: declare symbols externally visible Marek Behún
2021-03-04  0:37   ` Tom Rini
2021-03-04  1:53     ` Marek Behun
2021-03-03  4:12 ` [RFC PATCH u-boot 06/12] build: support building with Link Time Optimizations Marek Behún
2021-03-05  6:34   ` Bin Meng
2021-03-03  4:12 ` [RFC PATCH u-boot 07/12] arch: sandbox: make LTO available Marek Behún
2021-03-03  4:12 ` [RFC PATCH u-boot 08/12] sandbox: build with LTO Marek Behún
2021-03-03  4:12 ` [RFC PATCH u-boot 09/12] ARM: make gd a function for LTO Marek Behún
2021-03-03  4:12 ` [RFC PATCH u-boot 10/12] string: make memcpy() visible to fix LTO linking errors Marek Behún
2021-03-03  4:12 ` [RFC PATCH u-boot 11/12] arch: ARM: make LTO available Marek Behún
2021-03-03  4:12 ` [RFC PATCH u-boot 12/12] Nokia RX-51: build with LTO Marek Behún
2021-03-03 16:11 ` [RFC PATCH u-boot 00/12] U-Boot LTO (Sandbox + ARM Nokia RX-51) Tom Rini
2021-03-03 16:41   ` Marek Behun
2021-03-03 16:47     ` Tom Rini
2021-03-03 21:36     ` Tom Rini
2021-03-04  0:40       ` Adam Ford
2021-03-04  7:07         ` [PATCH] arm: fix LTO build for some thumb-interwork cases Marek Behún
2021-03-04 10:43       ` [RFC PATCH u-boot 00/12] U-Boot LTO (Sandbox + ARM Nokia RX-51) Marek Behun
2021-03-04 13:46         ` Adam Ford
2021-03-04 13:50           ` Marek Behun
2021-03-04 13:59             ` Adam Ford
2021-03-04 14:58           ` Tom Rini
2021-03-04 15:07             ` Adam Ford
2021-03-04 15:37               ` Marek Behun
2021-03-04 16:18                 ` Tom Rini
2021-03-04 15:59               ` Marek Behun
2021-03-04 22:18                 ` Adam Ford
2021-03-04 22:33                   ` Marek Behun
2021-03-05 11:25                     ` Adam Ford
2021-03-05 12:31                       ` Stefan Roese
2021-03-05 17:10                         ` Adam Ford
2021-03-06  3:03                           ` Adam Ford
2021-03-06 11:12                             ` Adam Ford
2021-03-06 17:37                               ` Marek Behun
2021-03-06 20:08                                 ` Tom Rini
2021-03-06 20:41                                   ` Pali Rohár
2021-03-06 20:54                                     ` Marek Behun
2021-03-06 21:00                                       ` Pali Rohár
2021-03-06 21:19                                         ` Marek Behun
2021-03-06 21:38                                           ` Pali Rohár
2021-03-06 21:49                                             ` Marek Behun
2021-03-07  3:45                                               ` Adam Ford
2021-03-07  4:06                                                 ` Marek Behun
2021-05-09 14:14                                                   ` Adam Ford
2021-05-09 18:44                                                     ` Marek Behun
2021-05-10 16:28                                                       ` Simon Glass
2021-05-13  9:22                                                         ` Pali Rohár
2021-03-04 16:17               ` Tom Rini
2021-03-04 16:35                 ` Pali Rohár

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.