All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Marek Behún" <marek.behun@nic.cz>
To: u-boot@lists.denx.de
Subject: [PATCH u-boot v4 00/36] U-Boot LTO (Sandbox + Some ARM boards)
Date: Thu, 20 May 2021 13:23:49 +0200	[thread overview]
Message-ID: <20210520112425.25166-1-marek.behun@nic.cz> (raw)

Hello,

this is version 4 of patches adding support for LTO to U-Boot.

This series is being tested by Github/Azure CI at
  https://github.com/u-boot/u-boot/pull/57

There is a problem with sandbox_clang test scenario, which I was
unable to resolve yet, or even determine correctly whether the
problem is with my patches or was there before. (One of the
problems is with testing stack protector test_stackprotector.py,
but for some reason I could not make this work even with GCC on
my local machine.)
Nevertheless I am sending these patches now so that at least you
can review them. In the meantime I will try to resolve the issue
with sandbox_clang test scenario.

Changes since v3:
- for some reason the mvneta driver does not work correctly when
  U-Boot is compiled with LTO. I have not debugged this issue yet, so
  for now I have removed Turris Omnia and Turris MOX from devices with
  enabled LTO
- linker list entry symbols are now forced to emit by using the
  __ADDRESSABLE macro in a generated C file (keep-syms-lto.c).
  Previously this was done in the ll_entry_declare() macro, but this
  was not flexible, since, for example, trying to declare an entry as
  extern could not work that way. This came to attention now after
  Simon's patches for dtoc were merged, and ll_entry_declare() is
  being used with the extern keyword in include/generated/dt-decl.h
- when compiling LTO with Clang, use llvm-ar and llvm-nm for AR and NM
- several patches rebased
- removed patch "api: fix a potential serious bug caused by undef
  CONFIG_SYS_64BIT_LBA"
- updated patch converting __attribute__((section(...))) to
  __section(...)

Changes sinve v2:                       
- now linking with --build-id=none in order to avoid link failures with
  some toolchains (thanks Herald Seiler)
- we don't use -flto=jobserver anymore, since it causes build errors for
  some people. Instead we link with -flto=NPROC
- removed LTO exception for arch/arm/mach-omap2/omap3/clock.o, Adam Ford
  says it is not needed
- added some Reviewed-by tags

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)

Marek

Marek Beh?n (36):
  regmap: fix a serious pointer casting bug
  checkpatch: require quotes around section name in the __section()
    macro
  treewide: Convert macro and uses of __section(foo) to __section("foo")
  compiler.h: align the __ADDRESSABLE macro with Linux' version
  test/py: improve regular expression for ut subtest symbol matcher
  string: make memcpy(), memset(), memcmp() and memmove() visible for
    LTO
  efi_loader: fix warning when linking with LTO
  efi_loader: add Sphinx doc for __efi_runtime and __efi_runtime_data
  efi_loader: add macro for const EFI runtime data
  efi_selftest: compiler flags for efi_selftest_miniapp_exception.o
  lib: crc32: put the crc_table variable into efi_runtime_rodata section
  Makefile, Makefile.spl: cosmetic change
  build: use thin archives instead of incremental linking
  build: support building with Link Time Optimizations
  build: link with --build-id=none
  sandbox: errno: avoid conflict with libc's errno
  sandbox: use sections instead of symbols for getopt array boundaries
  sandbox: make LTO available
  sandbox: enable LTO by default
  ARM: global_data: make set_gd() work for armv5 and armv6
  ARM: make gd a function call for LTO and set via set_gd()
  ARM: fix LTO build for some thumb-interwork cases
  ARM: fix LTO for imx28_xea
  ARM: fix LTO for apf27
  ARM: fix LTO for keystone
  ARM: kona: fix clk_bsc_enable() type mismatch for LTO
  ARM: imx8m: fix imx_eqos_txclk_set_rate() type mismatch for LTO
  ARM: fix LTO for seaboard
  ARM: fix LTO for rockchip and samsung
  ARM: omap3: fix LTO for DM3730 (and possibly other omap3 boards)
  armv8: SPL: discard relocation information
  ata: ahci: fix ahci_link_up() type mismatch for LTO
  ARM: make LTO available
  ARM: don't use -ffunction-sections/-fdata-sections with LTO build
  ARM: don't use --gc-sections with LTO when using private libgcc
  ARM: enable LTO for some boards

 Kbuild                                     |  2 +
 Kconfig                                    | 24 +++++++
 Makefile                                   | 81 ++++++++++++++++++++--
 arch/Kconfig                               |  3 +
 arch/arm/config.mk                         | 10 ++-
 arch/arm/cpu/arm926ejs/Makefile            |  2 +
 arch/arm/cpu/arm926ejs/mxs/mxs.c           |  2 +-
 arch/arm/cpu/arm926ejs/mxs/spl_boot.c      |  4 +-
 arch/arm/cpu/arm926ejs/spear/spl.c         |  2 +-
 arch/arm/cpu/armv7/kona-common/clk-stubs.c |  2 +-
 arch/arm/cpu/armv7/ls102xa/ls102xa_psci.c  |  2 +-
 arch/arm/cpu/armv8/spl_data.c              |  4 +-
 arch/arm/cpu/armv8/u-boot-spl.lds          |  1 +
 arch/arm/include/asm/global_data.h         |  6 +-
 arch/arm/include/asm/secure.h              |  6 +-
 arch/arm/include/asm/setup.h               |  2 +-
 arch/arm/lib/Makefile                      |  3 +
 arch/arm/lib/sections.c                    | 31 +++++----
 arch/arm/lib/spl.c                         |  2 +-
 arch/arm/mach-at91/spl.c                   |  2 +-
 arch/arm/mach-exynos/spl_boot.c            |  2 +-
 arch/arm/mach-imx/imx8m/clock_imx8mm.c     |  2 +-
 arch/arm/mach-imx/imx8m/soc.c              |  2 +-
 arch/arm/mach-imx/spl_imx_romapi.c         | 16 ++---
 arch/arm/mach-k3/am642_init.c              |  2 +-
 arch/arm/mach-k3/am6_init.c                |  2 +-
 arch/arm/mach-k3/j721e_init.c              |  4 +-
 arch/arm/mach-keystone/Makefile            |  1 +
 arch/arm/mach-mvebu/mbus.c                 |  4 +-
 arch/arm/mach-mvebu/timer.c                |  2 +-
 arch/arm/mach-nexell/clock.c               |  6 +-
 arch/arm/mach-nexell/timer.c               |  6 +-
 arch/arm/mach-omap2/omap3/Makefile         |  1 +
 arch/arm/mach-rockchip/board.c             |  2 +-
 arch/arm/mach-socfpga/spl_a10.c            |  2 +-
 arch/arm/mach-sunxi/board.c                |  2 +-
 arch/arm/mach-tegra/board.c                |  2 +-
 arch/arm/mach-tegra/cboot.c                |  8 +--
 arch/arm/mach-tegra/tegra20/Makefile       |  1 +
 arch/mips/mach-jz47xx/jz4780/jz4780.c      |  2 +-
 arch/nds32/include/asm/setup.h             |  6 +-
 arch/powerpc/include/asm/cache.h           |  4 +-
 arch/riscv/cpu/cpu.c                       |  4 +-
 arch/sandbox/config.mk                     | 14 +++-
 arch/sandbox/cpu/os.c                      |  3 +-
 arch/sandbox/cpu/start.c                   |  3 +-
 arch/sandbox/cpu/u-boot-spl.lds            |  8 ++-
 arch/sandbox/cpu/u-boot.lds                |  8 ++-
 arch/sandbox/include/asm/getopt.h          |  2 +-
 arch/sandbox/include/asm/sections.h        | 21 +++++-
 arch/sandbox/lib/sections.c                |  9 +--
 arch/x86/cpu/coreboot/timestamp.c          |  2 +-
 arch/x86/lib/coreboot/cb_sysinfo.c         |  2 +-
 arch/x86/lib/sections.c                    |  9 +--
 arch/xtensa/cpu/cpu.c                      |  2 +-
 board/bosch/shc/board.c                    |  2 +-
 board/broadcom/bcmstb/bcmstb.c             |  2 +-
 board/samsung/arndale/arndale_spl.c        |  2 +-
 board/samsung/common/exynos5-dt.c          |  2 +-
 board/samsung/smdk5250/smdk5250_spl.c      |  2 +-
 board/samsung/smdk5420/smdk5420_spl.c      |  2 +-
 board/siemens/draco/board.c                |  2 +-
 board/xilinx/common/fru_ops.c              |  2 +-
 configs/am3517_evm_defconfig               |  1 +
 configs/da850evm_defconfig                 |  1 +
 configs/da850evm_direct_nor_defconfig      |  1 +
 configs/da850evm_nand_defconfig            |  1 +
 configs/imx6q_logic_defconfig              |  1 +
 configs/imx8mm_beacon_defconfig            |  1 +
 configs/imx8mm_venice_defconfig            |  1 +
 configs/imx8mn_beacon_2g_defconfig         |  1 +
 configs/imx8mn_beacon_defconfig            |  1 +
 configs/nokia_rx51_defconfig               |  1 +
 configs/omap3_logic_defconfig              |  1 +
 configs/r8a774a1_beacon_defconfig          |  1 +
 configs/r8a774b1_beacon_defconfig          |  1 +
 configs/r8a774e1_beacon_defconfig          |  1 +
 drivers/ata/ahci.c                         |  2 +-
 drivers/bios_emulator/biosemu.c            |  4 +-
 drivers/clk/kendryte/clk.c                 |  4 +-
 drivers/core/regmap.c                      | 59 +++++++++++++++-
 drivers/firmware/psci.c                    |  2 +-
 drivers/mtd/nand/raw/mxc_nand_spl.c        |  2 +-
 drivers/pinctrl/nxp/pinctrl-imx5.c         |  2 +-
 drivers/pinctrl/nxp/pinctrl-imx7.c         |  2 +-
 drivers/pinctrl/nxp/pinctrl-imx8m.c        |  2 +-
 drivers/power/pmic/pmic_tps62362.c         |  2 +-
 drivers/power/pmic/pmic_tps65217.c         |  2 +-
 drivers/power/pmic/pmic_tps65218.c         |  2 +-
 drivers/power/pmic/pmic_tps65910.c         |  2 +-
 drivers/serial/serial_pl01x.c              |  4 +-
 include/efi_loader.h                       | 54 +++++++++++++--
 include/errno.h                            |  8 ++-
 include/linker_lists.h                     | 24 +++----
 include/linux/compiler.h                   | 10 +--
 include/linux/compiler_attributes.h        |  2 +-
 lib/crc32.c                                |  3 +-
 lib/efi_selftest/Makefile                  |  2 +
 lib/errno.c                                |  4 +-
 lib/string.c                               |  9 +--
 lib/trace.c                                |  4 +-
 scripts/Makefile.build                     | 16 ++---
 scripts/Makefile.lib                       |  3 +
 scripts/Makefile.spl                       | 63 +++++++++++++++--
 scripts/checkpatch.pl                      |  2 +-
 scripts/gen_ll_addressable_symbols.sh      | 12 ++++
 test/py/conftest.py                        |  2 +-
 107 files changed, 513 insertions(+), 183 deletions(-)
 create mode 100755 scripts/gen_ll_addressable_symbols.sh

-- 
2.26.3

             reply	other threads:[~2021-05-20 11:23 UTC|newest]

Thread overview: 111+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-20 11:23 Marek Behún [this message]
2021-05-20 11:23 ` [PATCH u-boot v4 01/36] regmap: fix a serious pointer casting bug Marek Behún
2021-05-20 17:51   ` Simon Glass
2021-05-20 19:30     ` Marek Behun
2021-05-25  0:54   ` Tom Rini
2021-05-20 11:23 ` [PATCH u-boot v4 02/36] checkpatch: require quotes around section name in the __section() macro Marek Behún
2021-05-20 17:51   ` Simon Glass
2021-05-25  0:54   ` Tom Rini
2021-05-20 11:23 ` [PATCH u-boot v4 03/36] treewide: Convert macro and uses of __section(foo) to __section("foo") Marek Behún
2021-05-20 17:51   ` Simon Glass
2021-05-25  0:54   ` Tom Rini
2021-05-20 11:23 ` [PATCH u-boot v4 04/36] compiler.h: align the __ADDRESSABLE macro with Linux' version Marek Behún
2021-05-25  0:54   ` Tom Rini
2021-05-20 11:23 ` [PATCH u-boot v4 05/36] test/py: improve regular expression for ut subtest symbol matcher Marek Behún
2021-05-20 17:51   ` Simon Glass
2021-05-25  0:54   ` Tom Rini
2021-05-20 11:23 ` [PATCH u-boot v4 06/36] string: make memcpy(), memset(), memcmp() and memmove() visible for LTO Marek Behún
2021-05-20 17:51   ` Simon Glass
2021-05-25  0:54   ` Tom Rini
2021-05-20 11:23 ` [PATCH u-boot v4 07/36] efi_loader: fix warning when linking with LTO Marek Behún
2021-05-25  0:54   ` Tom Rini
2021-05-20 11:23 ` [PATCH u-boot v4 08/36] efi_loader: add Sphinx doc for __efi_runtime and __efi_runtime_data Marek Behún
2021-05-25  0:54   ` Tom Rini
2021-05-20 11:23 ` [PATCH u-boot v4 09/36] efi_loader: add macro for const EFI runtime data Marek Behún
2021-05-25  0:55   ` Tom Rini
2021-05-20 11:23 ` [PATCH u-boot v4 10/36] efi_selftest: compiler flags for efi_selftest_miniapp_exception.o Marek Behún
2021-05-25  0:55   ` Tom Rini
2021-05-20 11:24 ` [PATCH u-boot v4 11/36] lib: crc32: put the crc_table variable into efi_runtime_rodata section Marek Behún
2021-05-25  0:55   ` Tom Rini
2021-05-20 11:24 ` [PATCH u-boot v4 12/36] Makefile, Makefile.spl: cosmetic change Marek Behún
2021-05-25  0:55   ` Tom Rini
2021-05-25  0:55   ` Tom Rini
2021-05-20 11:24 ` [PATCH u-boot v4 13/36] build: use thin archives instead of incremental linking Marek Behún
2021-05-20 17:51   ` Simon Glass
2021-05-25  0:55   ` Tom Rini
2021-05-20 11:24 ` [PATCH u-boot v4 14/36] build: support building with Link Time Optimizations Marek Behún
2021-05-20 17:51   ` Simon Glass
2021-05-25  0:55   ` Tom Rini
2021-05-20 11:24 ` [PATCH u-boot v4 15/36] build: link with --build-id=none Marek Behún
2021-05-20 17:51   ` Simon Glass
2021-05-25  0:55   ` Tom Rini
2021-05-20 11:24 ` [PATCH u-boot v4 16/36] sandbox: errno: avoid conflict with libc's errno Marek Behún
2021-05-25  0:55   ` Tom Rini
2021-05-20 11:24 ` [PATCH u-boot v4 17/36] sandbox: use sections instead of symbols for getopt array boundaries Marek Behún
2021-05-20 17:51   ` Simon Glass
2021-05-25  0:55   ` Tom Rini
2021-05-20 11:24 ` [PATCH u-boot v4 18/36] sandbox: make LTO available Marek Behún
2021-05-25  0:55   ` Tom Rini
2021-05-20 11:24 ` [PATCH u-boot v4 19/36] sandbox: enable LTO by default Marek Behún
2021-05-25  0:56   ` Tom Rini
2021-05-20 11:24 ` [PATCH u-boot v4 20/36] ARM: global_data: make set_gd() work for armv5 and armv6 Marek Behún
2021-05-20 17:51   ` Simon Glass
2021-05-25  0:56   ` Tom Rini
2021-05-20 11:24 ` [PATCH u-boot v4 21/36] ARM: make gd a function call for LTO and set via set_gd() Marek Behún
2021-05-20 17:52   ` Simon Glass
2021-05-25  0:56   ` Tom Rini
2021-05-20 11:24 ` [PATCH u-boot v4 22/36] ARM: fix LTO build for some thumb-interwork cases Marek Behún
2021-05-20 17:52   ` Simon Glass
2021-05-25  0:56   ` Tom Rini
2021-05-20 11:24 ` [PATCH u-boot v4 23/36] ARM: fix LTO for imx28_xea Marek Behún
2021-05-25  0:56   ` Tom Rini
2021-05-20 11:24 ` [PATCH u-boot v4 24/36] ARM: fix LTO for apf27 Marek Behún
2021-05-25  0:56   ` Tom Rini
2021-05-20 11:24 ` [PATCH u-boot v4 25/36] ARM: fix LTO for keystone Marek Behún
2021-05-25  0:56   ` Tom Rini
2021-05-20 11:24 ` [PATCH u-boot v4 26/36] ARM: kona: fix clk_bsc_enable() type mismatch for LTO Marek Behún
2021-05-25  0:56   ` Tom Rini
2021-05-20 11:24 ` [PATCH u-boot v4 27/36] ARM: imx8m: fix imx_eqos_txclk_set_rate() " Marek Behún
2021-05-25  0:56   ` Tom Rini
2021-05-20 11:24 ` [PATCH u-boot v4 28/36] ARM: fix LTO for seaboard Marek Behún
2021-05-20 17:52   ` Simon Glass
2021-05-25  0:56   ` Tom Rini
2021-05-20 11:24 ` [PATCH u-boot v4 29/36] ARM: fix LTO for rockchip and samsung Marek Behún
2021-05-22  2:45   ` Kever Yang
2021-05-25  0:56   ` Tom Rini
2021-05-20 11:24 ` [PATCH u-boot v4 30/36] ARM: omap3: fix LTO for DM3730 (and possibly other omap3 boards) Marek Behún
2021-05-25  0:57   ` Tom Rini
2021-05-20 11:24 ` [PATCH u-boot v4 31/36] armv8: SPL: discard relocation information Marek Behún
2021-05-20 17:52   ` Simon Glass
2021-05-25  0:57   ` Tom Rini
2021-05-20 11:24 ` [PATCH u-boot v4 32/36] ata: ahci: fix ahci_link_up() type mismatch for LTO Marek Behún
2021-05-25  0:57   ` Tom Rini
2021-05-20 11:24 ` [PATCH u-boot v4 33/36] ARM: make LTO available Marek Behún
2021-05-20 17:52   ` Simon Glass
2021-05-25  0:57   ` Tom Rini
2021-05-20 11:24 ` [PATCH u-boot v4 34/36] ARM: don't use -ffunction-sections/-fdata-sections with LTO build Marek Behún
2021-05-20 17:52   ` Simon Glass
2021-05-25  0:57   ` Tom Rini
2021-05-20 11:24 ` [PATCH u-boot v4 35/36] ARM: don't use --gc-sections with LTO when using private libgcc Marek Behún
2021-05-20 17:52   ` Simon Glass
2021-05-25  0:57   ` Tom Rini
2021-05-20 11:24 ` [PATCH u-boot v4 36/36] ARM: enable LTO for some boards Marek Behún
2021-05-20 18:56   ` Adam Ford
2021-05-21 14:11     ` Tom Rini
2021-05-21 16:00       ` Marek Behún
2021-05-21 16:56         ` Tom Rini
2021-05-24 15:40           ` Tom Rini
2021-05-24 15:58             ` Marek Behun
2021-05-24 16:23               ` Tom Rini
2021-05-24 17:09               ` Tom Rini
2021-05-24 17:44                 ` Tom Rini
2021-05-24 19:19                   ` Marek Behun
2021-05-24 19:56                     ` Tom Rini
2021-05-24 19:54               ` Tom Rini
2021-05-21 16:00       ` Marek Behún
2021-05-25  0:57   ` Tom Rini
2021-06-01 14:59 ` [PATCH u-boot v4 00/36] U-Boot LTO (Sandbox + Some ARM boards) Patrick DELAUNAY
2021-06-01 15:05   ` Tom Rini
2021-06-01 16:22   ` Marek Behún
2021-06-01 16:55     ` Heinrich Schuchardt
2021-06-01 17:23       ` Tom Rini

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=20210520112425.25166-1-marek.behun@nic.cz \
    --to=marek.behun@nic.cz \
    --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 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.