Skip to content

arm: Make the LTO conditions in arch/arm/config.mk take effect

Josef Schlehofer u-boot 2 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v2 Latest5 patches 1 replyIn review
  2. v12 patches 2 repliesSuperseded

Changes in v2 from the cover letter

- Add patch 1 for the K3 R5 link failure, patch 2 for ARM64 and patch 3 for SKIP_RELOCATE_CODE.
- Test all 208 LTO boards instead of the 30 with CONFIG_LTO=y, and move the size figures from the patch notes to this cover letter.

[1] https://lore.kernel.org/u-boot/20261012190720.GF3722450@bill-the-cat/
[2] https://lore.kernel.org/u-boot/20261020212819.GK720525@bill-the-cat/
v1: https://lore.kernel.org/u-boot/[email protected]/

Patches in v2 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/5arm: cache-cp15: Do not reference the MMU helper without an MMUarch/arm/lib/cache-cp15.c+2 -00 replies
2/5arm: Keep -ffunction-sections -fdata-sections with LTO on ARM64arch/arm/config.mk+1 -10 replies
3/5arm: Keep the section flags with LTO and SKIP_RELOCATE_CODEarch/arm/config.mk+1 -10 replies
4/5arm: Keep --gc-sections with LTOarch/arm/config.mk+0 -20 replies
5/5Makefile: Set LTO_ENABLE before including config.mkMakefile+7 -70 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v2 yet.

Read the v2 thread

Cover letter [PATCH v2 0/5] arm: Make the LTO conditions in arch/arm/config.mk take effect

As requested in the mpc85xx LTO review [1], this sets LTO_ENABLE before arch/arm/config.mk is read, so that 32-bit ARM LTO builds of U-Boot proper leave out -ffunction-sections -fdata-sections.

v1 broke the K3 R5 link [2]. Patch 1 fixes the dangling reference in arch/arm/lib/cache-cp15.c that the missing -ffunction-sections exposed. Patch 2 keeps both flags on ARM64, where U-Boot proper would otherwise grow on 104 of 105 boards, by up to 30240 bytes on i.MX8M. Patch 3 keeps them with SKIP_RELOCATE_CODE, whose data relocation does not expect section anchors. Patch 4 keeps --gc-sections, without which 32-bit U-Boot proper would be 2080 to 10832 bytes larger.

Build-tested on all 208 ARM LTO boards in the U-Boot CI container. Patches 1 to 4 change no image. Patch 5 shrinks u-boot-nodtb.bin of the 102 32-bit boards by 896 to 4464 bytes. No other image changes, and NO_LTO=1 builds stay the same.

Boot-tested on a Turris Omnia, one of these 32-bit boards, loaded into RAM with kwboot. SPL and U-Boot print the same boot log as on main apart from the version, and the mmc, sf, i2c, usb and wdt commands give the same output.

Changes in v2:
- Add patch 1 for the K3 R5 link failure, patch 2 for ARM64 and patch 3 for SKIP_RELOCATE_CODE.
- Test all 208 LTO boards instead of the 30 with CONFIG_LTO=y, and move the size figures from the patch notes to this cover letter.

[1] https://lore.kernel.org/u-boot/20261012190720.GF3722450@bill-the-cat/
[2] https://lore.kernel.org/u-boot/20261020212819.GK720525@bill-the-cat/
v1: https://lore.kernel.org/u-boot/[email protected]/

Josef Schlehofer (5):
arm: cache-cp15: Do not reference the MMU helper without an MMU
arm: Keep -ffunction-sections -fdata-sections with LTO on ARM64
arm: Keep the section flags with LTO and SKIP_RELOCATE_CODE
arm: Keep --gc-sections with LTO
Makefile: Set LTO_ENABLE before including config.mk

 Makefile                  | 14 +++++++-------
 arch/arm/config.mk        |  4 +---
 arch/arm/lib/cache-cp15.c |  2 ++
 3 files changed, 10 insertions(+), 10 deletions(-)
Signature · 1 line
2.54.0 (Apple Git-157)