Skip to contentSkip to conversation

ARM: enable LTO for some boards

PATCH New Marek Behún 4 participants 12 messages Mar 12, 2021 – Mar 16, 2021 1 message not in the archive

Subsystems (2)
lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): CAHCN7xK29J6ymGqupEaSTF+wm9yzArayQJ4TPm_19ReNF62SUQ@mail.gmail.com

#1 lore raw

PATCH 38/38 ARM: enable LTO for some boards

Enable LTO for some boards that were tested by people on U-Boot Mailing List.

---
 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 +
 configs/turris_mox_defconfig          | 1 +
 configs/turris_omnia_defconfig        | 1 +
 16 files changed, 16 insertions(+)
configs/am3517_evm_defconfig +1 -0
index bae0e0af35..d61eec94a4 100644
@@ -1,3 +1,4 @@
+CONFIG_LTO=y
 CONFIG_ARM=y
 # CONFIG_SPL_USE_ARCH_MEMCPY is not set
 # CONFIG_SPL_USE_ARCH_MEMSET is not set
configs/da850evm_defconfig +1 -0
index 26e76a2929..6ff5e21bc6 100644
@@ -1,3 +1,4 @@
+CONFIG_LTO=y
 CONFIG_ARM=y
 CONFIG_SYS_THUMB_BUILD=y
 CONFIG_ARCH_DAVINCI=y
configs/da850evm_direct_nor_defconfig +1 -0
index d3860a963d..06c7ce7c47 100644
@@ -1,3 +1,4 @@
+CONFIG_LTO=y
 CONFIG_ARM=y
 CONFIG_ARCH_CPU_INIT=y
 CONFIG_ARCH_DAVINCI=y
configs/da850evm_nand_defconfig +1 -0
index 0d0e9a148d..be737564e1 100644
@@ -1,3 +1,4 @@
+CONFIG_LTO=y
 CONFIG_ARM=y
 CONFIG_SYS_THUMB_BUILD=y
 CONFIG_ARCH_DAVINCI=y
configs/imx6q_logic_defconfig +1 -0
index 36dc24d080..0f8aea6983 100644
@@ -1,3 +1,4 @@
+CONFIG_LTO=y
 CONFIG_ARM=y
 CONFIG_ARCH_MX6=y
 CONFIG_SYS_TEXT_BASE=0x17800000
configs/imx8mm_beacon_defconfig +1 -0
index 045b19f4f3..e8bb44eea6 100644
@@ -1,3 +1,4 @@
+CONFIG_LTO=y
 CONFIG_ARM=y
 CONFIG_ARCH_IMX8M=y
 CONFIG_SYS_TEXT_BASE=0x40200000
configs/imx8mm_venice_defconfig +1 -0
index a15c3641f6..dff8f64540 100644
@@ -1,3 +1,4 @@
+CONFIG_LTO=y
 CONFIG_ARM=y
 CONFIG_ARCH_IMX8M=y
 CONFIG_SYS_TEXT_BASE=0x40200000
configs/imx8mn_beacon_2g_defconfig +1 -0
index 58b8e49486..1c8cbc2c89 100644
@@ -1,3 +1,4 @@
+CONFIG_LTO=y
 CONFIG_ARM=y
 CONFIG_ARCH_IMX8M=y
 CONFIG_SYS_TEXT_BASE=0x40200000
configs/imx8mn_beacon_defconfig +1 -0
index d6a3385d8d..6457b9409a 100644
@@ -1,3 +1,4 @@
+CONFIG_LTO=y
 CONFIG_ARM=y
 CONFIG_ARCH_IMX8M=y
 CONFIG_SYS_TEXT_BASE=0x40200000
configs/nokia_rx51_defconfig +1 -0
index 312ca3a1a9..85ca627790 100644
@@ -1,3 +1,4 @@
+CONFIG_LTO=y
 CONFIG_ARM=y
 # CONFIG_SYS_THUMB_BUILD is not set
 CONFIG_ARCH_OMAP2PLUS=y
configs/omap3_logic_defconfig +1 -0
index 4e37237b86..cc4b727a2c 100644
@@ -1,3 +1,4 @@
+CONFIG_LTO=y
 CONFIG_ARM=y
 # CONFIG_SPL_USE_ARCH_MEMCPY is not set
 # CONFIG_SPL_USE_ARCH_MEMSET is not set
configs/r8a774a1_beacon_defconfig +1 -0
index 2f45edd92e..9dd5d9192e 100644
@@ -1,3 +1,4 @@
+CONFIG_LTO=y
 CONFIG_ARM=y
 CONFIG_ARCH_RMOBILE=y
 CONFIG_SYS_TEXT_BASE=0x50000000
configs/r8a774b1_beacon_defconfig +1 -0
index ca514bb1aa..b7d7f23f5a 100644
@@ -1,3 +1,4 @@
+CONFIG_LTO=y
 CONFIG_ARM=y
 CONFIG_ARCH_RMOBILE=y
 CONFIG_SYS_TEXT_BASE=0x50000000
configs/r8a774e1_beacon_defconfig +1 -0
index b89729d92a..3e44edf29f 100644
@@ -1,3 +1,4 @@
+CONFIG_LTO=y
 CONFIG_ARM=y
 CONFIG_ARCH_RMOBILE=y
 CONFIG_SYS_TEXT_BASE=0x50000000
configs/turris_mox_defconfig +1 -0
index f938fbb475..2a351d9180 100644
@@ -1,3 +1,4 @@
+CONFIG_LTO=y
 CONFIG_ARM=y
 CONFIG_ARCH_CPU_INIT=y
 CONFIG_ARCH_MVEBU=y
configs/turris_omnia_defconfig +1 -0
index 4b8843d7be..d7a2ec3592 100644
@@ -1,3 +1,4 @@
+CONFIG_LTO=y
 CONFIG_ARM=y
 CONFIG_ARCH_CPU_INIT=y
 CONFIG_SPL_SYS_THUMB_BUILD=y
Signature · 1 line
2.26.2
#2 lore raw

PATCH 38/38 ARM: enable LTO for some boards

Quoted 172 lines · Marek Beh?n

Enable LTO for some boards that were tested by people on U-Boot Mailing List.

---
 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 +
 configs/turris_mox_defconfig          | 1 +
 configs/turris_omnia_defconfig        | 1 +
 16 files changed, 16 insertions(+)
configs/am3517_evm_defconfig +1 -0
index bae0e0af35..d61eec94a4 100644
@@ -1,3 +1,4 @@
+CONFIG_LTO=y
 CONFIG_ARM=y
 # CONFIG_SPL_USE_ARCH_MEMCPY is not set
 # CONFIG_SPL_USE_ARCH_MEMSET is not set
configs/da850evm_defconfig +1 -0
index 26e76a2929..6ff5e21bc6 100644
@@ -1,3 +1,4 @@
+CONFIG_LTO=y
 CONFIG_ARM=y
 CONFIG_SYS_THUMB_BUILD=y
 CONFIG_ARCH_DAVINCI=y
configs/da850evm_direct_nor_defconfig +1 -0
index d3860a963d..06c7ce7c47 100644
@@ -1,3 +1,4 @@
+CONFIG_LTO=y
 CONFIG_ARM=y
 CONFIG_ARCH_CPU_INIT=y
 CONFIG_ARCH_DAVINCI=y
configs/da850evm_nand_defconfig +1 -0
index 0d0e9a148d..be737564e1 100644
@@ -1,3 +1,4 @@
+CONFIG_LTO=y
 CONFIG_ARM=y
 CONFIG_SYS_THUMB_BUILD=y
 CONFIG_ARCH_DAVINCI=y
configs/imx6q_logic_defconfig +1 -0
index 36dc24d080..0f8aea6983 100644
@@ -1,3 +1,4 @@
+CONFIG_LTO=y
 CONFIG_ARM=y
 CONFIG_ARCH_MX6=y
 CONFIG_SYS_TEXT_BASE=0x17800000
configs/imx8mm_beacon_defconfig +1 -0
index 045b19f4f3..e8bb44eea6 100644
@@ -1,3 +1,4 @@
+CONFIG_LTO=y
 CONFIG_ARM=y
 CONFIG_ARCH_IMX8M=y
 CONFIG_SYS_TEXT_BASE=0x40200000
configs/imx8mm_venice_defconfig +1 -0
index a15c3641f6..dff8f64540 100644
@@ -1,3 +1,4 @@
+CONFIG_LTO=y
 CONFIG_ARM=y
 CONFIG_ARCH_IMX8M=y
 CONFIG_SYS_TEXT_BASE=0x40200000
configs/imx8mn_beacon_2g_defconfig +1 -0
index 58b8e49486..1c8cbc2c89 100644
@@ -1,3 +1,4 @@
+CONFIG_LTO=y
 CONFIG_ARM=y
 CONFIG_ARCH_IMX8M=y
 CONFIG_SYS_TEXT_BASE=0x40200000
configs/imx8mn_beacon_defconfig +1 -0
index d6a3385d8d..6457b9409a 100644
@@ -1,3 +1,4 @@
+CONFIG_LTO=y
 CONFIG_ARM=y
 CONFIG_ARCH_IMX8M=y
 CONFIG_SYS_TEXT_BASE=0x40200000
configs/nokia_rx51_defconfig +1 -0
index 312ca3a1a9..85ca627790 100644
@@ -1,3 +1,4 @@
+CONFIG_LTO=y
 CONFIG_ARM=y
 # CONFIG_SYS_THUMB_BUILD is not set
 CONFIG_ARCH_OMAP2PLUS=y
configs/omap3_logic_defconfig +1 -0
index 4e37237b86..cc4b727a2c 100644
@@ -1,3 +1,4 @@
+CONFIG_LTO=y
 CONFIG_ARM=y
 # CONFIG_SPL_USE_ARCH_MEMCPY is not set
 # CONFIG_SPL_USE_ARCH_MEMSET is not set
configs/r8a774a1_beacon_defconfig +1 -0
index 2f45edd92e..9dd5d9192e 100644
@@ -1,3 +1,4 @@
+CONFIG_LTO=y
 CONFIG_ARM=y
 CONFIG_ARCH_RMOBILE=y
 CONFIG_SYS_TEXT_BASE=0x50000000
configs/r8a774b1_beacon_defconfig +1 -0
index ca514bb1aa..b7d7f23f5a 100644
@@ -1,3 +1,4 @@
+CONFIG_LTO=y
 CONFIG_ARM=y
 CONFIG_ARCH_RMOBILE=y
 CONFIG_SYS_TEXT_BASE=0x50000000
configs/r8a774e1_beacon_defconfig +1 -0
index b89729d92a..3e44edf29f 100644
@@ -1,3 +1,4 @@
+CONFIG_LTO=y
 CONFIG_ARM=y
 CONFIG_ARCH_RMOBILE=y
 CONFIG_SYS_TEXT_BASE=0x50000000
configs/turris_mox_defconfig +1 -0
index f938fbb475..2a351d9180 100644
@@ -1,3 +1,4 @@
+CONFIG_LTO=y
 CONFIG_ARM=y
 CONFIG_ARCH_CPU_INIT=y
 CONFIG_ARCH_MVEBU=y
configs/turris_omnia_defconfig +1 -1
index 4b8843d7be..d7a2ec3592 100644
@@ -1,3 +1,4 @@
+CONFIG_LTO=y
 CONFIG_ARM=y
 CONFIG_ARCH_CPU_INIT=y
 CONFIG_SPL_SYS_THUMB_BUILD=y
--
Quoted 2 lines

2.26.2

Marek,

Perhaps I didn't test the property test before as I did not realize there was a config to be enabled.

Enabling CONFIG_LTO breaks linking the SPL (linking uboot is fine):
LTO spl/u-boot-spl
make[2]: *** read jobs pipe: No such file or directory. Stop.
make[2]: *** Waiting for unfinished jobs....
lto-wrapper: fatal error: make returned 2 exit status
compilation terminated. /usr/src/venice/buildroot/output/host/lib/gcc/aarch64-buildroot-linux-gnu/9.3.0/../../../../aarch64-buildroot-linux-gnu/bin/ld:
error: lto-wrapper failed
collect2: error: ld returned 1 exit status
scripts/Makefile.spl:461: recipe for target 'spl/u-boot-spl' failed
make[1]: *** [spl/u-boot-spl] Error 1
Makefile:1985: recipe for target 'spl/u-boot-spl' failed
make: *** [spl/u-boot-spl] Error 2

I'm using your lto branch

Best Regards,

Tim

#3 lore raw

PATCH 38/38 ARM: enable LTO for some boards

Quoted 195 lines · On Fri, 12 Mar 2021 08:34:41 -0800 Tim Harvey <[email protected]> wrote:
Quoted 172 lines · Marek Beh?n

Enable LTO for some boards that were tested by people on U-Boot Mailing List.

---
 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 +
 configs/turris_mox_defconfig          | 1 +
 configs/turris_omnia_defconfig        | 1 +
 16 files changed, 16 insertions(+)
configs/am3517_evm_defconfig +1 -0
index bae0e0af35..d61eec94a4 100644
@@ -1,3 +1,4 @@
+CONFIG_LTO=y
 CONFIG_ARM=y
 # CONFIG_SPL_USE_ARCH_MEMCPY is not set
 # CONFIG_SPL_USE_ARCH_MEMSET is not set
configs/da850evm_defconfig +1 -0
index 26e76a2929..6ff5e21bc6 100644
@@ -1,3 +1,4 @@
+CONFIG_LTO=y
 CONFIG_ARM=y
 CONFIG_SYS_THUMB_BUILD=y
 CONFIG_ARCH_DAVINCI=y
configs/da850evm_direct_nor_defconfig +1 -0
index d3860a963d..06c7ce7c47 100644
@@ -1,3 +1,4 @@
+CONFIG_LTO=y
 CONFIG_ARM=y
 CONFIG_ARCH_CPU_INIT=y
 CONFIG_ARCH_DAVINCI=y
configs/da850evm_nand_defconfig +1 -0
index 0d0e9a148d..be737564e1 100644
@@ -1,3 +1,4 @@
+CONFIG_LTO=y
 CONFIG_ARM=y
 CONFIG_SYS_THUMB_BUILD=y
 CONFIG_ARCH_DAVINCI=y
configs/imx6q_logic_defconfig +1 -0
index 36dc24d080..0f8aea6983 100644
@@ -1,3 +1,4 @@
+CONFIG_LTO=y
 CONFIG_ARM=y
 CONFIG_ARCH_MX6=y
 CONFIG_SYS_TEXT_BASE=0x17800000
configs/imx8mm_beacon_defconfig +1 -0
index 045b19f4f3..e8bb44eea6 100644
@@ -1,3 +1,4 @@
+CONFIG_LTO=y
 CONFIG_ARM=y
 CONFIG_ARCH_IMX8M=y
 CONFIG_SYS_TEXT_BASE=0x40200000
configs/imx8mm_venice_defconfig +1 -0
index a15c3641f6..dff8f64540 100644
@@ -1,3 +1,4 @@
+CONFIG_LTO=y
 CONFIG_ARM=y
 CONFIG_ARCH_IMX8M=y
 CONFIG_SYS_TEXT_BASE=0x40200000
configs/imx8mn_beacon_2g_defconfig +1 -0
index 58b8e49486..1c8cbc2c89 100644
@@ -1,3 +1,4 @@
+CONFIG_LTO=y
 CONFIG_ARM=y
 CONFIG_ARCH_IMX8M=y
 CONFIG_SYS_TEXT_BASE=0x40200000
configs/imx8mn_beacon_defconfig +1 -0
index d6a3385d8d..6457b9409a 100644
@@ -1,3 +1,4 @@
+CONFIG_LTO=y
 CONFIG_ARM=y
 CONFIG_ARCH_IMX8M=y
 CONFIG_SYS_TEXT_BASE=0x40200000
configs/nokia_rx51_defconfig +1 -0
index 312ca3a1a9..85ca627790 100644
@@ -1,3 +1,4 @@
+CONFIG_LTO=y
 CONFIG_ARM=y
 # CONFIG_SYS_THUMB_BUILD is not set
 CONFIG_ARCH_OMAP2PLUS=y
configs/omap3_logic_defconfig +1 -0
index 4e37237b86..cc4b727a2c 100644
@@ -1,3 +1,4 @@
+CONFIG_LTO=y
 CONFIG_ARM=y
 # CONFIG_SPL_USE_ARCH_MEMCPY is not set
 # CONFIG_SPL_USE_ARCH_MEMSET is not set
configs/r8a774a1_beacon_defconfig +1 -0
index 2f45edd92e..9dd5d9192e 100644
@@ -1,3 +1,4 @@
+CONFIG_LTO=y
 CONFIG_ARM=y
 CONFIG_ARCH_RMOBILE=y
 CONFIG_SYS_TEXT_BASE=0x50000000
configs/r8a774b1_beacon_defconfig +1 -0
index ca514bb1aa..b7d7f23f5a 100644
@@ -1,3 +1,4 @@
+CONFIG_LTO=y
 CONFIG_ARM=y
 CONFIG_ARCH_RMOBILE=y
 CONFIG_SYS_TEXT_BASE=0x50000000
configs/r8a774e1_beacon_defconfig +1 -0
index b89729d92a..3e44edf29f 100644
@@ -1,3 +1,4 @@
+CONFIG_LTO=y
 CONFIG_ARM=y
 CONFIG_ARCH_RMOBILE=y
 CONFIG_SYS_TEXT_BASE=0x50000000
configs/turris_mox_defconfig +1 -0
index f938fbb475..2a351d9180 100644
@@ -1,3 +1,4 @@
+CONFIG_LTO=y
 CONFIG_ARM=y
 CONFIG_ARCH_CPU_INIT=y
 CONFIG_ARCH_MVEBU=y
configs/turris_omnia_defconfig +1 -1
index 4b8843d7be..d7a2ec3592 100644
@@ -1,3 +1,4 @@
+CONFIG_LTO=y
 CONFIG_ARM=y
 CONFIG_ARCH_CPU_INIT=y
 CONFIG_SPL_SYS_THUMB_BUILD=y
--
Quoted 2 lines

2.26.2

Marek,

Perhaps I didn't test the property test before as I did not realize there was a config to be enabled.

Enabling CONFIG_LTO breaks linking the SPL (linking uboot is fine):
LTO spl/u-boot-spl
make[2]: *** read jobs pipe: No such file or directory. Stop.
make[2]: *** Waiting for unfinished jobs....
lto-wrapper: fatal error: make returned 2 exit status
compilation terminated. /usr/src/venice/buildroot/output/host/lib/gcc/aarch64-buildroot-linux-gnu/9.3.0/../../../../aarch64-buildroot-linux-gnu/bin/ld:
error: lto-wrapper failed
collect2: error: ld returned 1 exit status
scripts/Makefile.spl:461: recipe for target 'spl/u-boot-spl' failed
make[1]: *** [spl/u-boot-spl] Error 1
Makefile:1985: recipe for target 'spl/u-boot-spl' failed
make: *** [spl/u-boot-spl] Error 2

Quoted 5 lines

I'm using your lto branch

Best Regards,

Tim

Tim, try compiling with only one job, i.e.
make -j1

#4 lore raw

PATCH 38/38 ARM: enable LTO for some boards

Quoted 197 lines · Marek Behun
Quoted 194 lines · On Fri, 12 Mar 2021 08:34:41 -0800 Tim Harvey <[email protected]> wrote:
Quoted 171 lines · Marek Beh?n

Enable LTO for some boards that were tested by people on U-Boot Mailing List.

---
 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 +
 configs/turris_mox_defconfig          | 1 +
 configs/turris_omnia_defconfig        | 1 +
 16 files changed, 16 insertions(+)
configs/am3517_evm_defconfig +1 -0
index bae0e0af35..d61eec94a4 100644
@@ -1,3 +1,4 @@
+CONFIG_LTO=y
 CONFIG_ARM=y
 # CONFIG_SPL_USE_ARCH_MEMCPY is not set
 # CONFIG_SPL_USE_ARCH_MEMSET is not set
configs/da850evm_defconfig +1 -0
index 26e76a2929..6ff5e21bc6 100644
@@ -1,3 +1,4 @@
+CONFIG_LTO=y
 CONFIG_ARM=y
 CONFIG_SYS_THUMB_BUILD=y
 CONFIG_ARCH_DAVINCI=y
configs/da850evm_direct_nor_defconfig +1 -0
index d3860a963d..06c7ce7c47 100644
@@ -1,3 +1,4 @@
+CONFIG_LTO=y
 CONFIG_ARM=y
 CONFIG_ARCH_CPU_INIT=y
 CONFIG_ARCH_DAVINCI=y
configs/da850evm_nand_defconfig +1 -0
index 0d0e9a148d..be737564e1 100644
@@ -1,3 +1,4 @@
+CONFIG_LTO=y
 CONFIG_ARM=y
 CONFIG_SYS_THUMB_BUILD=y
 CONFIG_ARCH_DAVINCI=y
configs/imx6q_logic_defconfig +1 -0
index 36dc24d080..0f8aea6983 100644
@@ -1,3 +1,4 @@
+CONFIG_LTO=y
 CONFIG_ARM=y
 CONFIG_ARCH_MX6=y
 CONFIG_SYS_TEXT_BASE=0x17800000
configs/imx8mm_beacon_defconfig +1 -0
index 045b19f4f3..e8bb44eea6 100644
@@ -1,3 +1,4 @@
+CONFIG_LTO=y
 CONFIG_ARM=y
 CONFIG_ARCH_IMX8M=y
 CONFIG_SYS_TEXT_BASE=0x40200000
configs/imx8mm_venice_defconfig +1 -0
index a15c3641f6..dff8f64540 100644
@@ -1,3 +1,4 @@
+CONFIG_LTO=y
 CONFIG_ARM=y
 CONFIG_ARCH_IMX8M=y
 CONFIG_SYS_TEXT_BASE=0x40200000
configs/imx8mn_beacon_2g_defconfig +1 -0
index 58b8e49486..1c8cbc2c89 100644
@@ -1,3 +1,4 @@
+CONFIG_LTO=y
 CONFIG_ARM=y
 CONFIG_ARCH_IMX8M=y
 CONFIG_SYS_TEXT_BASE=0x40200000
configs/imx8mn_beacon_defconfig +1 -0
index d6a3385d8d..6457b9409a 100644
@@ -1,3 +1,4 @@
+CONFIG_LTO=y
 CONFIG_ARM=y
 CONFIG_ARCH_IMX8M=y
 CONFIG_SYS_TEXT_BASE=0x40200000
configs/nokia_rx51_defconfig +1 -0
index 312ca3a1a9..85ca627790 100644
@@ -1,3 +1,4 @@
+CONFIG_LTO=y
 CONFIG_ARM=y
 # CONFIG_SYS_THUMB_BUILD is not set
 CONFIG_ARCH_OMAP2PLUS=y
configs/omap3_logic_defconfig +1 -0
index 4e37237b86..cc4b727a2c 100644
@@ -1,3 +1,4 @@
+CONFIG_LTO=y
 CONFIG_ARM=y
 # CONFIG_SPL_USE_ARCH_MEMCPY is not set
 # CONFIG_SPL_USE_ARCH_MEMSET is not set
configs/r8a774a1_beacon_defconfig +1 -0
index 2f45edd92e..9dd5d9192e 100644
@@ -1,3 +1,4 @@
+CONFIG_LTO=y
 CONFIG_ARM=y
 CONFIG_ARCH_RMOBILE=y
 CONFIG_SYS_TEXT_BASE=0x50000000
configs/r8a774b1_beacon_defconfig +1 -0
index ca514bb1aa..b7d7f23f5a 100644
@@ -1,3 +1,4 @@
+CONFIG_LTO=y
 CONFIG_ARM=y
 CONFIG_ARCH_RMOBILE=y
 CONFIG_SYS_TEXT_BASE=0x50000000
configs/r8a774e1_beacon_defconfig +1 -0
index b89729d92a..3e44edf29f 100644
@@ -1,3 +1,4 @@
+CONFIG_LTO=y
 CONFIG_ARM=y
 CONFIG_ARCH_RMOBILE=y
 CONFIG_SYS_TEXT_BASE=0x50000000
configs/turris_mox_defconfig +1 -0
index f938fbb475..2a351d9180 100644
@@ -1,3 +1,4 @@
+CONFIG_LTO=y
 CONFIG_ARM=y
 CONFIG_ARCH_CPU_INIT=y
 CONFIG_ARCH_MVEBU=y
configs/turris_omnia_defconfig +1 -1
index 4b8843d7be..d7a2ec3592 100644
@@ -1,3 +1,4 @@
+CONFIG_LTO=y>>>  CONFIG_ARM=y
 CONFIG_ARCH_CPU_INIT=y
 CONFIG_SPL_SYS_THUMB_BUILD=y
--
Quoted 2 lines

2.26.2

Marek,

Perhaps I didn't test the property test before as I did not realize there was a config to be enabled.

Enabling CONFIG_LTO breaks linking the SPL (linking uboot is fine):
LTO spl/u-boot-spl
make[2]: *** read jobs pipe: No such file or directory. Stop.
make[2]: *** Waiting for unfinished jobs....
lto-wrapper: fatal error: make returned 2 exit status
compilation terminated. /usr/src/venice/buildroot/output/host/lib/gcc/aarch64-buildroot-linux-gnu/9.3.0/../../../../aarch64-buildroot-linux-gnu/bin/ld:
error: lto-wrapper failed
collect2: error: ld returned 1 exit status
scripts/Makefile.spl:461: recipe for target 'spl/u-boot-spl' failed
make[1]: *** [spl/u-boot-spl] Error 1
Makefile:1985: recipe for target 'spl/u-boot-spl' failed
make: *** [spl/u-boot-spl] Error 2

Quoted 9 lines
Quoted 5 lines

I'm using your lto branch

Best Regards,

Tim

Tim, try compiling with only one job, i.e.
make -j1

If parallel build fails, we have a bug in the Makefile. It worked fine without the LTO patches.

The problem needs to be fixed before merging your series.

Best regards

Heinrich

#5 lore raw

PATCH 38/38 ARM: enable LTO for some boards

Quoted 202 lines · On Fri, 12 Mar 2021 18:19:08 +0100 Heinrich Schuchardt <[email protected]>…
Quoted 201 lines · Marek Behun
Quoted 198 lines · On Fri, 12 Mar 2021 08:34:41 -0800 Tim Harvey <[email protected]> wrote:
Quoted 171 lines · Marek Beh?n

Enable LTO for some boards that were tested by people on U-Boot Mailing List.

---
 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 +
 configs/turris_mox_defconfig          | 1 +
 configs/turris_omnia_defconfig        | 1 +
 16 files changed, 16 insertions(+)
configs/am3517_evm_defconfig +1 -0
index bae0e0af35..d61eec94a4 100644
@@ -1,3 +1,4 @@
+CONFIG_LTO=y
 CONFIG_ARM=y
 # CONFIG_SPL_USE_ARCH_MEMCPY is not set
 # CONFIG_SPL_USE_ARCH_MEMSET is not set
configs/da850evm_defconfig +1 -0
index 26e76a2929..6ff5e21bc6 100644
@@ -1,3 +1,4 @@
+CONFIG_LTO=y
 CONFIG_ARM=y
 CONFIG_SYS_THUMB_BUILD=y
 CONFIG_ARCH_DAVINCI=y
configs/da850evm_direct_nor_defconfig +1 -0
index d3860a963d..06c7ce7c47 100644
@@ -1,3 +1,4 @@
+CONFIG_LTO=y
 CONFIG_ARM=y
 CONFIG_ARCH_CPU_INIT=y
 CONFIG_ARCH_DAVINCI=y
configs/da850evm_nand_defconfig +1 -0
index 0d0e9a148d..be737564e1 100644
@@ -1,3 +1,4 @@
+CONFIG_LTO=y
 CONFIG_ARM=y
 CONFIG_SYS_THUMB_BUILD=y
 CONFIG_ARCH_DAVINCI=y
configs/imx6q_logic_defconfig +1 -0
index 36dc24d080..0f8aea6983 100644
@@ -1,3 +1,4 @@
+CONFIG_LTO=y
 CONFIG_ARM=y
 CONFIG_ARCH_MX6=y
 CONFIG_SYS_TEXT_BASE=0x17800000
configs/imx8mm_beacon_defconfig +1 -0
index 045b19f4f3..e8bb44eea6 100644
@@ -1,3 +1,4 @@
+CONFIG_LTO=y
 CONFIG_ARM=y
 CONFIG_ARCH_IMX8M=y
 CONFIG_SYS_TEXT_BASE=0x40200000
configs/imx8mm_venice_defconfig +1 -0
index a15c3641f6..dff8f64540 100644
@@ -1,3 +1,4 @@
+CONFIG_LTO=y
 CONFIG_ARM=y
 CONFIG_ARCH_IMX8M=y
 CONFIG_SYS_TEXT_BASE=0x40200000
configs/imx8mn_beacon_2g_defconfig +1 -0
index 58b8e49486..1c8cbc2c89 100644
@@ -1,3 +1,4 @@
+CONFIG_LTO=y
 CONFIG_ARM=y
 CONFIG_ARCH_IMX8M=y
 CONFIG_SYS_TEXT_BASE=0x40200000
configs/imx8mn_beacon_defconfig +1 -0
index d6a3385d8d..6457b9409a 100644
@@ -1,3 +1,4 @@
+CONFIG_LTO=y
 CONFIG_ARM=y
 CONFIG_ARCH_IMX8M=y
 CONFIG_SYS_TEXT_BASE=0x40200000
configs/nokia_rx51_defconfig +1 -0
index 312ca3a1a9..85ca627790 100644
@@ -1,3 +1,4 @@
+CONFIG_LTO=y
 CONFIG_ARM=y
 # CONFIG_SYS_THUMB_BUILD is not set
 CONFIG_ARCH_OMAP2PLUS=y
configs/omap3_logic_defconfig +1 -0
index 4e37237b86..cc4b727a2c 100644
@@ -1,3 +1,4 @@
+CONFIG_LTO=y
 CONFIG_ARM=y
 # CONFIG_SPL_USE_ARCH_MEMCPY is not set
 # CONFIG_SPL_USE_ARCH_MEMSET is not set
configs/r8a774a1_beacon_defconfig +1 -0
index 2f45edd92e..9dd5d9192e 100644
@@ -1,3 +1,4 @@
+CONFIG_LTO=y
 CONFIG_ARM=y
 CONFIG_ARCH_RMOBILE=y
 CONFIG_SYS_TEXT_BASE=0x50000000
configs/r8a774b1_beacon_defconfig +1 -0
index ca514bb1aa..b7d7f23f5a 100644
@@ -1,3 +1,4 @@
+CONFIG_LTO=y
 CONFIG_ARM=y
 CONFIG_ARCH_RMOBILE=y
 CONFIG_SYS_TEXT_BASE=0x50000000
configs/r8a774e1_beacon_defconfig +1 -0
index b89729d92a..3e44edf29f 100644
@@ -1,3 +1,4 @@
+CONFIG_LTO=y
 CONFIG_ARM=y
 CONFIG_ARCH_RMOBILE=y
 CONFIG_SYS_TEXT_BASE=0x50000000
configs/turris_mox_defconfig +1 -0
index f938fbb475..2a351d9180 100644
@@ -1,3 +1,4 @@
+CONFIG_LTO=y
 CONFIG_ARM=y
 CONFIG_ARCH_CPU_INIT=y
 CONFIG_ARCH_MVEBU=y
configs/turris_omnia_defconfig +1 -1
index 4b8843d7be..d7a2ec3592 100644
@@ -1,3 +1,4 @@  
+CONFIG_LTO=y>>>  CONFIG_ARM=y  
 CONFIG_ARCH_CPU_INIT=y
 CONFIG_SPL_SYS_THUMB_BUILD=y
--
Quoted 2 lines

2.26.2

Marek,

Perhaps I didn't test the property test before as I did not realize there was a config to be enabled.

Enabling CONFIG_LTO breaks linking the SPL (linking uboot is fine):
LTO spl/u-boot-spl
make[2]: *** read jobs pipe: No such file or directory. Stop.
make[2]: *** Waiting for unfinished jobs....
lto-wrapper: fatal error: make returned 2 exit status
compilation terminated. /usr/src/venice/buildroot/output/host/lib/gcc/aarch64-buildroot-linux-gnu/9.3.0/../../../../aarch64-buildroot-linux-gnu/bin/ld:
error: lto-wrapper failed
collect2: error: ld returned 1 exit status
scripts/Makefile.spl:461: recipe for target 'spl/u-boot-spl' failed
make[1]: *** [spl/u-boot-spl] Error 1
Makefile:1985: recipe for target 'spl/u-boot-spl' failed
make: *** [spl/u-boot-spl] Error 2

I'm using your lto branch

Best Regards,

Quoted 8 lines
Quoted 5 lines
Quoted 1 line

Tim

Tim, try compiling with only one job, i.e.
make -j1

If parallel build fails, we have a bug in the Makefile. It worked fine without the LTO patches.

It may be a problem with GNU make's jobserver. Tom mentioned that there is a known race condition or something...

If only there was a simple way to discover inside the Makefile the number of jobs given to the make command via the -j parameter, we could use -flto=$(JOBS).

I found this
https://blog.jgc.org/2015/03/gnu-make-insanity-finding-value-of-j.html

Marek

#6 lore raw

PATCH 38/38 ARM: enable LTO for some boards

Quoted 218 lines · Marek Behun
Quoted 202 lines · On Fri, 12 Mar 2021 18:19:08 +0100 Heinrich Schuchardt <[email protected]>…
Quoted 201 lines · Marek Behun
Quoted 198 lines · On Fri, 12 Mar 2021 08:34:41 -0800 Tim Harvey <[email protected]> wrote:
Quoted 171 lines · Marek Beh?n

Enable LTO for some boards that were tested by people on U-Boot Mailing List.

---
 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 +
 configs/turris_mox_defconfig          | 1 +
 configs/turris_omnia_defconfig        | 1 +
 16 files changed, 16 insertions(+)
configs/am3517_evm_defconfig +1 -0
index bae0e0af35..d61eec94a4 100644
@@ -1,3 +1,4 @@
+CONFIG_LTO=y
 CONFIG_ARM=y
 # CONFIG_SPL_USE_ARCH_MEMCPY is not set
 # CONFIG_SPL_USE_ARCH_MEMSET is not set
configs/da850evm_defconfig +1 -0
index 26e76a2929..6ff5e21bc6 100644
@@ -1,3 +1,4 @@
+CONFIG_LTO=y
 CONFIG_ARM=y
 CONFIG_SYS_THUMB_BUILD=y
 CONFIG_ARCH_DAVINCI=y
configs/da850evm_direct_nor_defconfig +1 -0
index d3860a963d..06c7ce7c47 100644
@@ -1,3 +1,4 @@
+CONFIG_LTO=y
 CONFIG_ARM=y
 CONFIG_ARCH_CPU_INIT=y
 CONFIG_ARCH_DAVINCI=y
configs/da850evm_nand_defconfig +1 -0
index 0d0e9a148d..be737564e1 100644
@@ -1,3 +1,4 @@
+CONFIG_LTO=y
 CONFIG_ARM=y
 CONFIG_SYS_THUMB_BUILD=y
 CONFIG_ARCH_DAVINCI=y
configs/imx6q_logic_defconfig +1 -0
index 36dc24d080..0f8aea6983 100644
@@ -1,3 +1,4 @@
+CONFIG_LTO=y
 CONFIG_ARM=y
 CONFIG_ARCH_MX6=y
 CONFIG_SYS_TEXT_BASE=0x17800000
configs/imx8mm_beacon_defconfig +1 -0
index 045b19f4f3..e8bb44eea6 100644
@@ -1,3 +1,4 @@
+CONFIG_LTO=y
 CONFIG_ARM=y
 CONFIG_ARCH_IMX8M=y
 CONFIG_SYS_TEXT_BASE=0x40200000
configs/imx8mm_venice_defconfig +1 -0
index a15c3641f6..dff8f64540 100644
@@ -1,3 +1,4 @@
+CONFIG_LTO=y
 CONFIG_ARM=y
 CONFIG_ARCH_IMX8M=y
 CONFIG_SYS_TEXT_BASE=0x40200000
configs/imx8mn_beacon_2g_defconfig +1 -0
index 58b8e49486..1c8cbc2c89 100644
@@ -1,3 +1,4 @@
+CONFIG_LTO=y
 CONFIG_ARM=y
 CONFIG_ARCH_IMX8M=y
 CONFIG_SYS_TEXT_BASE=0x40200000
configs/imx8mn_beacon_defconfig +1 -0
index d6a3385d8d..6457b9409a 100644
@@ -1,3 +1,4 @@
+CONFIG_LTO=y
 CONFIG_ARM=y
 CONFIG_ARCH_IMX8M=y
 CONFIG_SYS_TEXT_BASE=0x40200000
configs/nokia_rx51_defconfig +1 -0
index 312ca3a1a9..85ca627790 100644
@@ -1,3 +1,4 @@
+CONFIG_LTO=y
 CONFIG_ARM=y
 # CONFIG_SYS_THUMB_BUILD is not set
 CONFIG_ARCH_OMAP2PLUS=y
configs/omap3_logic_defconfig +1 -0
index 4e37237b86..cc4b727a2c 100644
@@ -1,3 +1,4 @@
+CONFIG_LTO=y
 CONFIG_ARM=y
 # CONFIG_SPL_USE_ARCH_MEMCPY is not set
 # CONFIG_SPL_USE_ARCH_MEMSET is not set
configs/r8a774a1_beacon_defconfig +1 -0
index 2f45edd92e..9dd5d9192e 100644
@@ -1,3 +1,4 @@
+CONFIG_LTO=y
 CONFIG_ARM=y
 CONFIG_ARCH_RMOBILE=y
 CONFIG_SYS_TEXT_BASE=0x50000000
configs/r8a774b1_beacon_defconfig +1 -0
index ca514bb1aa..b7d7f23f5a 100644
@@ -1,3 +1,4 @@
+CONFIG_LTO=y
 CONFIG_ARM=y
 CONFIG_ARCH_RMOBILE=y
 CONFIG_SYS_TEXT_BASE=0x50000000
configs/r8a774e1_beacon_defconfig +1 -0
index b89729d92a..3e44edf29f 100644
@@ -1,3 +1,4 @@
+CONFIG_LTO=y
 CONFIG_ARM=y
 CONFIG_ARCH_RMOBILE=y
 CONFIG_SYS_TEXT_BASE=0x50000000
configs/turris_mox_defconfig +1 -0
index f938fbb475..2a351d9180 100644
@@ -1,3 +1,4 @@
+CONFIG_LTO=y
 CONFIG_ARM=y
 CONFIG_ARCH_CPU_INIT=y
 CONFIG_ARCH_MVEBU=y
configs/turris_omnia_defconfig +1 -1
index 4b8843d7be..d7a2ec3592 100644
@@ -1,3 +1,4 @@
+CONFIG_LTO=y>>>  CONFIG_ARM=y
 CONFIG_ARCH_CPU_INIT=y
 CONFIG_SPL_SYS_THUMB_BUILD=y
--
Quoted 2 lines

2.26.2

Marek,

Perhaps I didn't test the property test before as I did not realize there was a config to be enabled.

Enabling CONFIG_LTO breaks linking the SPL (linking uboot is fine):
LTO spl/u-boot-spl
make[2]: *** read jobs pipe: No such file or directory. Stop.
make[2]: *** Waiting for unfinished jobs....
lto-wrapper: fatal error: make returned 2 exit status
compilation terminated. /usr/src/venice/buildroot/output/host/lib/gcc/aarch64-buildroot-linux-gnu/9.3.0/../../../../aarch64-buildroot-linux-gnu/bin/ld:
error: lto-wrapper failed
collect2: error: ld returned 1 exit status
scripts/Makefile.spl:461: recipe for target 'spl/u-boot-spl' failed
make[1]: *** [spl/u-boot-spl] Error 1
Makefile:1985: recipe for target 'spl/u-boot-spl' failed
make: *** [spl/u-boot-spl] Error 2

I'm using your lto branch

Best Regards,

Quoted 8 lines
Quoted 5 lines
Quoted 1 line

Tim

Tim, try compiling with only one job, i.e.
make -j1

If parallel build fails, we have a bug in the Makefile. It worked fine without the LTO patches.

It may be a problem with GNU make's jobserver. Tom mentioned that there is a known race condition or something...

Quoted 8 lines

If only there was a simple way to discover inside the Makefile the number of jobs given to the make command via the -j parameter, we could use -flto=$(JOBS).

I found this
https://blog.jgc.org/2015/03/gnu-make-insanity-finding-value-of-j.html

Marek

Marek / Heinrich,

Yes, 'make -j1' does work.

Tim

#7 lore raw

PATCH 38/38 ARM: enable LTO for some boards

Quoted 5 lines · On Fri, 12 Mar 2021 10:01:34 -0800 Tim Harvey <[email protected]> wrote:

Marek / Heinrich,

Yes, 'make -j1' does work.

Tim

Tim, could you try make -j8, but change the toplevel Makefile:
find string "-flto=jobserver" and change it to "-flto".

Does make -j8 fail then?

Thank you.

Marek

#8 lore raw

PATCH 38/38 ARM: enable LTO for some boards

Quoted 8 lines · Marek Behun
Quoted 4 lines · On Fri, 12 Mar 2021 10:01:34 -0800 Tim Harvey <[email protected]> wrote:

Marek / Heinrich,

Yes, 'make -j1' does work.

Quoted 9 lines
Quoted 1 line

Tim

Tim, could you try make -j8, but change the toplevel Makefile:
find string "-flto=jobserver" and change it to "-flto".

Does make -j8 fail then?

Thank you.

Marek,

Makefile +1 -1
index 9518ba4a32..20b27e6dd5 100644
@@ -688,7 +688,7 @@ ifdef CONFIG_LTO
        ifeq ($(cc-name),clang)
                LTO_FINAL_LDFLAGS       += -flto
        else
-               LTO_FINAL_LDFLAGS       += -fuse-linker-plugin -flto=jobserver
+               LTO_FINAL_LDFLAGS       += -fuse-linker-plugin -flto
 
                # use plugin aware tools
                AR                      = $(CROSS_COMPILE)gcc-ar

make distclean imx8mm_venice_defconfig
make -j8 flash.bin

This now builds but the LTO steps do take noticeably several seconds longer than without LTO (13 seconds without CONFIG_LTO vs 23 seconds with) which is a bummer for development workflow.

You can of course play with building this as well... if you need me to boot test something I can do that for you (and this does boot just fine).

Best regards,

Tim

#9 lore raw

PATCH 38/38 ARM: enable LTO for some boards

In reply to Marek Behun
Quoted 211 lines · Marek Behun
Quoted 208 lines · On Fri, 12 Mar 2021 18:19:08 +0100 Heinrich Schuchardt <[email protected]>…
Quoted 206 lines · Marek Behun
Quoted 194 lines · On Fri, 12 Mar 2021 08:34:41 -0800 Tim Harvey <[email protected]> wrote:
Quoted 171 lines · Marek Beh?n

Enable LTO for some boards that were tested by people on U-Boot Mailing List.

---
 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 +
 configs/turris_mox_defconfig          | 1 +
 configs/turris_omnia_defconfig        | 1 +
 16 files changed, 16 insertions(+)
configs/am3517_evm_defconfig +1 -0
index bae0e0af35..d61eec94a4 100644
@@ -1,3 +1,4 @@
+CONFIG_LTO=y
 CONFIG_ARM=y
 # CONFIG_SPL_USE_ARCH_MEMCPY is not set
 # CONFIG_SPL_USE_ARCH_MEMSET is not set
configs/da850evm_defconfig +1 -0
index 26e76a2929..6ff5e21bc6 100644
@@ -1,3 +1,4 @@
+CONFIG_LTO=y
 CONFIG_ARM=y
 CONFIG_SYS_THUMB_BUILD=y
 CONFIG_ARCH_DAVINCI=y
configs/da850evm_direct_nor_defconfig +1 -0
index d3860a963d..06c7ce7c47 100644
@@ -1,3 +1,4 @@
+CONFIG_LTO=y
 CONFIG_ARM=y
 CONFIG_ARCH_CPU_INIT=y
 CONFIG_ARCH_DAVINCI=y
configs/da850evm_nand_defconfig +1 -0
index 0d0e9a148d..be737564e1 100644
@@ -1,3 +1,4 @@
+CONFIG_LTO=y
 CONFIG_ARM=y
 CONFIG_SYS_THUMB_BUILD=y
 CONFIG_ARCH_DAVINCI=y
configs/imx6q_logic_defconfig +1 -0
index 36dc24d080..0f8aea6983 100644
@@ -1,3 +1,4 @@
+CONFIG_LTO=y
 CONFIG_ARM=y
 CONFIG_ARCH_MX6=y
 CONFIG_SYS_TEXT_BASE=0x17800000
configs/imx8mm_beacon_defconfig +1 -0
index 045b19f4f3..e8bb44eea6 100644
@@ -1,3 +1,4 @@
+CONFIG_LTO=y
 CONFIG_ARM=y
 CONFIG_ARCH_IMX8M=y
 CONFIG_SYS_TEXT_BASE=0x40200000
configs/imx8mm_venice_defconfig +1 -0
index a15c3641f6..dff8f64540 100644
@@ -1,3 +1,4 @@
+CONFIG_LTO=y
 CONFIG_ARM=y
 CONFIG_ARCH_IMX8M=y
 CONFIG_SYS_TEXT_BASE=0x40200000
configs/imx8mn_beacon_2g_defconfig +1 -0
index 58b8e49486..1c8cbc2c89 100644
@@ -1,3 +1,4 @@
+CONFIG_LTO=y
 CONFIG_ARM=y
 CONFIG_ARCH_IMX8M=y
 CONFIG_SYS_TEXT_BASE=0x40200000
configs/imx8mn_beacon_defconfig +1 -0
index d6a3385d8d..6457b9409a 100644
@@ -1,3 +1,4 @@
+CONFIG_LTO=y
 CONFIG_ARM=y
 CONFIG_ARCH_IMX8M=y
 CONFIG_SYS_TEXT_BASE=0x40200000
configs/nokia_rx51_defconfig +1 -0
index 312ca3a1a9..85ca627790 100644
@@ -1,3 +1,4 @@
+CONFIG_LTO=y
 CONFIG_ARM=y
 # CONFIG_SYS_THUMB_BUILD is not set
 CONFIG_ARCH_OMAP2PLUS=y
configs/omap3_logic_defconfig +1 -0
index 4e37237b86..cc4b727a2c 100644
@@ -1,3 +1,4 @@
+CONFIG_LTO=y
 CONFIG_ARM=y
 # CONFIG_SPL_USE_ARCH_MEMCPY is not set
 # CONFIG_SPL_USE_ARCH_MEMSET is not set
configs/r8a774a1_beacon_defconfig +1 -0
index 2f45edd92e..9dd5d9192e 100644
@@ -1,3 +1,4 @@
+CONFIG_LTO=y
 CONFIG_ARM=y
 CONFIG_ARCH_RMOBILE=y
 CONFIG_SYS_TEXT_BASE=0x50000000
configs/r8a774b1_beacon_defconfig +1 -0
index ca514bb1aa..b7d7f23f5a 100644
@@ -1,3 +1,4 @@
+CONFIG_LTO=y
 CONFIG_ARM=y
 CONFIG_ARCH_RMOBILE=y
 CONFIG_SYS_TEXT_BASE=0x50000000
configs/r8a774e1_beacon_defconfig +1 -0
index b89729d92a..3e44edf29f 100644
@@ -1,3 +1,4 @@
+CONFIG_LTO=y
 CONFIG_ARM=y
 CONFIG_ARCH_RMOBILE=y
 CONFIG_SYS_TEXT_BASE=0x50000000
configs/turris_mox_defconfig +1 -0
index f938fbb475..2a351d9180 100644
@@ -1,3 +1,4 @@
+CONFIG_LTO=y
 CONFIG_ARM=y
 CONFIG_ARCH_CPU_INIT=y
 CONFIG_ARCH_MVEBU=y
configs/turris_omnia_defconfig +1 -1
index 4b8843d7be..d7a2ec3592 100644
@@ -1,3 +1,4 @@  
+CONFIG_LTO=y>>>  CONFIG_ARM=y  
 CONFIG_ARCH_CPU_INIT=y
 CONFIG_SPL_SYS_THUMB_BUILD=y
--
Quoted 2 lines

2.26.2

Marek,

Perhaps I didn't test the property test before as I did not realize there was a config to be enabled.

Enabling CONFIG_LTO breaks linking the SPL (linking uboot is fine):
LTO spl/u-boot-spl
make[2]: *** read jobs pipe: No such file or directory. Stop.
make[2]: *** Waiting for unfinished jobs....
lto-wrapper: fatal error: make returned 2 exit status
compilation terminated. /usr/src/venice/buildroot/output/host/lib/gcc/aarch64-buildroot-linux-gnu/9.3.0/../../../../aarch64-buildroot-linux-gnu/bin/ld:
error: lto-wrapper failed
collect2: error: ld returned 1 exit status
scripts/Makefile.spl:461: recipe for target 'spl/u-boot-spl' failed
make[1]: *** [spl/u-boot-spl] Error 1
Makefile:1985: recipe for target 'spl/u-boot-spl' failed
make: *** [spl/u-boot-spl] Error 2

Quoted 5 lines

I'm using your lto branch

Best Regards,

Tim

Tim, try compiling with only one job, i.e.
make -j1

Quoted 5 lines
Quoted 2 lines

If parallel build fails, we have a bug in the Makefile. It worked fine without the LTO patches.

It may be a problem with GNU make's jobserver. Tom mentioned that there is a known race condition or something...

I was unclear at the time, sorry. Yes, it sounds like there's some race condition these patches are adding that needs to be addressed. By the nature of race condition they aren't always easy to trigger, but we can't just ignore them if CI doesn't trip on it every time.

Quoted 6 lines

If only there was a simple way to discover inside the Makefile the number of jobs given to the make command via the -j parameter, we could use -flto=$(JOBS).

I found this
https://blog.jgc.org/2015/03/gnu-make-insanity-finding-value-of-j.html

Well, how is this being done in the Linux kernel? Or maybe, sigh, this isn't a problem with Clang's LTO which is what is in mainline Linux kernel atm. Maybe
https://lore.kernel.org/patchwork/project/lkml/list/?series=463749&state=*
will have some clues, all the same.

Signature · 8 lines
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/94df1715/attachment.sig>
#10 lore raw

PATCH 38/38 ARM: enable LTO for some boards

Quoted 227 lines · On Fri, 12 Mar 2021 15:47:12 -0500 Tom Rini <[email protected]> wrote:
Quoted 211 lines · Marek Behun
Quoted 208 lines · On Fri, 12 Mar 2021 18:19:08 +0100 Heinrich Schuchardt <[email protected]>…
Quoted 206 lines · Marek Behun
Quoted 194 lines · On Fri, 12 Mar 2021 08:34:41 -0800 Tim Harvey <[email protected]> wrote:
Quoted 171 lines · Marek Beh?n

Enable LTO for some boards that were tested by people on U-Boot Mailing List.

---
 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 +
 configs/turris_mox_defconfig          | 1 +
 configs/turris_omnia_defconfig        | 1 +
 16 files changed, 16 insertions(+)
configs/am3517_evm_defconfig +1 -0
index bae0e0af35..d61eec94a4 100644
@@ -1,3 +1,4 @@
+CONFIG_LTO=y
 CONFIG_ARM=y
 # CONFIG_SPL_USE_ARCH_MEMCPY is not set
 # CONFIG_SPL_USE_ARCH_MEMSET is not set
configs/da850evm_defconfig +1 -0
index 26e76a2929..6ff5e21bc6 100644
@@ -1,3 +1,4 @@
+CONFIG_LTO=y
 CONFIG_ARM=y
 CONFIG_SYS_THUMB_BUILD=y
 CONFIG_ARCH_DAVINCI=y
configs/da850evm_direct_nor_defconfig +1 -0
index d3860a963d..06c7ce7c47 100644
@@ -1,3 +1,4 @@
+CONFIG_LTO=y
 CONFIG_ARM=y
 CONFIG_ARCH_CPU_INIT=y
 CONFIG_ARCH_DAVINCI=y
configs/da850evm_nand_defconfig +1 -0
index 0d0e9a148d..be737564e1 100644
@@ -1,3 +1,4 @@
+CONFIG_LTO=y
 CONFIG_ARM=y
 CONFIG_SYS_THUMB_BUILD=y
 CONFIG_ARCH_DAVINCI=y
configs/imx6q_logic_defconfig +1 -0
index 36dc24d080..0f8aea6983 100644
@@ -1,3 +1,4 @@
+CONFIG_LTO=y
 CONFIG_ARM=y
 CONFIG_ARCH_MX6=y
 CONFIG_SYS_TEXT_BASE=0x17800000
configs/imx8mm_beacon_defconfig +1 -0
index 045b19f4f3..e8bb44eea6 100644
@@ -1,3 +1,4 @@
+CONFIG_LTO=y
 CONFIG_ARM=y
 CONFIG_ARCH_IMX8M=y
 CONFIG_SYS_TEXT_BASE=0x40200000
configs/imx8mm_venice_defconfig +1 -0
index a15c3641f6..dff8f64540 100644
@@ -1,3 +1,4 @@
+CONFIG_LTO=y
 CONFIG_ARM=y
 CONFIG_ARCH_IMX8M=y
 CONFIG_SYS_TEXT_BASE=0x40200000
configs/imx8mn_beacon_2g_defconfig +1 -0
index 58b8e49486..1c8cbc2c89 100644
@@ -1,3 +1,4 @@
+CONFIG_LTO=y
 CONFIG_ARM=y
 CONFIG_ARCH_IMX8M=y
 CONFIG_SYS_TEXT_BASE=0x40200000
configs/imx8mn_beacon_defconfig +1 -0
index d6a3385d8d..6457b9409a 100644
@@ -1,3 +1,4 @@
+CONFIG_LTO=y
 CONFIG_ARM=y
 CONFIG_ARCH_IMX8M=y
 CONFIG_SYS_TEXT_BASE=0x40200000
configs/nokia_rx51_defconfig +1 -0
index 312ca3a1a9..85ca627790 100644
@@ -1,3 +1,4 @@
+CONFIG_LTO=y
 CONFIG_ARM=y
 # CONFIG_SYS_THUMB_BUILD is not set
 CONFIG_ARCH_OMAP2PLUS=y
configs/omap3_logic_defconfig +1 -0
index 4e37237b86..cc4b727a2c 100644
@@ -1,3 +1,4 @@
+CONFIG_LTO=y
 CONFIG_ARM=y
 # CONFIG_SPL_USE_ARCH_MEMCPY is not set
 # CONFIG_SPL_USE_ARCH_MEMSET is not set
configs/r8a774a1_beacon_defconfig +1 -0
index 2f45edd92e..9dd5d9192e 100644
@@ -1,3 +1,4 @@
+CONFIG_LTO=y
 CONFIG_ARM=y
 CONFIG_ARCH_RMOBILE=y
 CONFIG_SYS_TEXT_BASE=0x50000000
configs/r8a774b1_beacon_defconfig +1 -0
index ca514bb1aa..b7d7f23f5a 100644
@@ -1,3 +1,4 @@
+CONFIG_LTO=y
 CONFIG_ARM=y
 CONFIG_ARCH_RMOBILE=y
 CONFIG_SYS_TEXT_BASE=0x50000000
configs/r8a774e1_beacon_defconfig +1 -0
index b89729d92a..3e44edf29f 100644
@@ -1,3 +1,4 @@
+CONFIG_LTO=y
 CONFIG_ARM=y
 CONFIG_ARCH_RMOBILE=y
 CONFIG_SYS_TEXT_BASE=0x50000000
configs/turris_mox_defconfig +1 -0
index f938fbb475..2a351d9180 100644
@@ -1,3 +1,4 @@
+CONFIG_LTO=y
 CONFIG_ARM=y
 CONFIG_ARCH_CPU_INIT=y
 CONFIG_ARCH_MVEBU=y
configs/turris_omnia_defconfig +1 -1
index 4b8843d7be..d7a2ec3592 100644
@@ -1,3 +1,4 @@    
+CONFIG_LTO=y>>>  CONFIG_ARM=y    
 CONFIG_ARCH_CPU_INIT=y
 CONFIG_SPL_SYS_THUMB_BUILD=y
--
Quoted 2 lines

2.26.2

Marek,

Perhaps I didn't test the property test before as I did not realize there was a config to be enabled.

Enabling CONFIG_LTO breaks linking the SPL (linking uboot is fine):
LTO spl/u-boot-spl
make[2]: *** read jobs pipe: No such file or directory. Stop.
make[2]: *** Waiting for unfinished jobs....
lto-wrapper: fatal error: make returned 2 exit status
compilation terminated. /usr/src/venice/buildroot/output/host/lib/gcc/aarch64-buildroot-linux-gnu/9.3.0/../../../../aarch64-buildroot-linux-gnu/bin/ld:
error: lto-wrapper failed
collect2: error: ld returned 1 exit status
scripts/Makefile.spl:461: recipe for target 'spl/u-boot-spl' failed
make[1]: *** [spl/u-boot-spl] Error 1
Makefile:1985: recipe for target 'spl/u-boot-spl' failed
make: *** [spl/u-boot-spl] Error 2

Quoted 5 lines

I'm using your lto branch

Best Regards,

Tim

Tim, try compiling with only one job, i.e.
make -j1

Quoted 5 lines
Quoted 2 lines

If parallel build fails, we have a bug in the Makefile. It worked fine without the LTO patches.

It may be a problem with GNU make's jobserver. Tom mentioned that there is a known race condition or something...

I was unclear at the time, sorry. Yes, it sounds like there's some race condition these patches are adding that needs to be addressed. By the nature of race condition they aren't always easy to trigger, but we can't just ignore them if CI doesn't trip on it every time.

Quoted 4 lines

If only there was a simple way to discover inside the Makefile the number of jobs given to the make command via the -j parameter, we could use -flto=$(JOBS).

Quoted 8 lines
Quoted 2 lines

I found this
https://blog.jgc.org/2015/03/gnu-make-insanity-finding-value-of-j.html

Well, how is this being done in the Linux kernel? Or maybe, sigh, this isn't a problem with Clang's LTO which is what is in mainline Linux kernel atm. Maybe
https://lore.kernel.org/patchwork/project/lkml/list/?series=463749&state=*
will have some clues, all the same.

Tom, I fear that the only stable and sane solution now is to drop jobserver and just do -flto, i.e. in one thread. This will increase compilation time, but will work for everyone.

Another option is to do -flto=NCPUs, but that would contradict user's choice of -j option, if they chose -j1, for example.

What do you think?

Marek

#11 lore raw

PATCH 38/38 ARM: enable LTO for some boards

Quoted 239 lines · Marek Behun
Quoted 227 lines · On Fri, 12 Mar 2021 15:47:12 -0500 Tom Rini <[email protected]> wrote:
Quoted 211 lines · Marek Behun
Quoted 208 lines · On Fri, 12 Mar 2021 18:19:08 +0100 Heinrich Schuchardt <[email protected]>…
Quoted 206 lines · Marek Behun
Quoted 194 lines · On Fri, 12 Mar 2021 08:34:41 -0800 Tim Harvey <[email protected]> wrote:
Quoted 171 lines · Marek Beh?n

Enable LTO for some boards that were tested by people on U-Boot Mailing List.

---
 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 +
 configs/turris_mox_defconfig          | 1 +
 configs/turris_omnia_defconfig        | 1 +
 16 files changed, 16 insertions(+)
configs/am3517_evm_defconfig +1 -0
index bae0e0af35..d61eec94a4 100644
@@ -1,3 +1,4 @@
+CONFIG_LTO=y
 CONFIG_ARM=y
 # CONFIG_SPL_USE_ARCH_MEMCPY is not set
 # CONFIG_SPL_USE_ARCH_MEMSET is not set
configs/da850evm_defconfig +1 -0
index 26e76a2929..6ff5e21bc6 100644
@@ -1,3 +1,4 @@
+CONFIG_LTO=y
 CONFIG_ARM=y
 CONFIG_SYS_THUMB_BUILD=y
 CONFIG_ARCH_DAVINCI=y
configs/da850evm_direct_nor_defconfig +1 -0
index d3860a963d..06c7ce7c47 100644
@@ -1,3 +1,4 @@
+CONFIG_LTO=y
 CONFIG_ARM=y
 CONFIG_ARCH_CPU_INIT=y
 CONFIG_ARCH_DAVINCI=y
configs/da850evm_nand_defconfig +1 -0
index 0d0e9a148d..be737564e1 100644
@@ -1,3 +1,4 @@
+CONFIG_LTO=y
 CONFIG_ARM=y
 CONFIG_SYS_THUMB_BUILD=y
 CONFIG_ARCH_DAVINCI=y
configs/imx6q_logic_defconfig +1 -0
index 36dc24d080..0f8aea6983 100644
@@ -1,3 +1,4 @@
+CONFIG_LTO=y
 CONFIG_ARM=y
 CONFIG_ARCH_MX6=y
 CONFIG_SYS_TEXT_BASE=0x17800000
configs/imx8mm_beacon_defconfig +1 -0
index 045b19f4f3..e8bb44eea6 100644
@@ -1,3 +1,4 @@
+CONFIG_LTO=y
 CONFIG_ARM=y
 CONFIG_ARCH_IMX8M=y
 CONFIG_SYS_TEXT_BASE=0x40200000
configs/imx8mm_venice_defconfig +1 -0
index a15c3641f6..dff8f64540 100644
@@ -1,3 +1,4 @@
+CONFIG_LTO=y
 CONFIG_ARM=y
 CONFIG_ARCH_IMX8M=y
 CONFIG_SYS_TEXT_BASE=0x40200000
configs/imx8mn_beacon_2g_defconfig +1 -0
index 58b8e49486..1c8cbc2c89 100644
@@ -1,3 +1,4 @@
+CONFIG_LTO=y
 CONFIG_ARM=y
 CONFIG_ARCH_IMX8M=y
 CONFIG_SYS_TEXT_BASE=0x40200000
configs/imx8mn_beacon_defconfig +1 -0
index d6a3385d8d..6457b9409a 100644
@@ -1,3 +1,4 @@
+CONFIG_LTO=y
 CONFIG_ARM=y
 CONFIG_ARCH_IMX8M=y
 CONFIG_SYS_TEXT_BASE=0x40200000
configs/nokia_rx51_defconfig +1 -0
index 312ca3a1a9..85ca627790 100644
@@ -1,3 +1,4 @@
+CONFIG_LTO=y
 CONFIG_ARM=y
 # CONFIG_SYS_THUMB_BUILD is not set
 CONFIG_ARCH_OMAP2PLUS=y
configs/omap3_logic_defconfig +1 -0
index 4e37237b86..cc4b727a2c 100644
@@ -1,3 +1,4 @@
+CONFIG_LTO=y
 CONFIG_ARM=y
 # CONFIG_SPL_USE_ARCH_MEMCPY is not set
 # CONFIG_SPL_USE_ARCH_MEMSET is not set
configs/r8a774a1_beacon_defconfig +1 -0
index 2f45edd92e..9dd5d9192e 100644
@@ -1,3 +1,4 @@
+CONFIG_LTO=y
 CONFIG_ARM=y
 CONFIG_ARCH_RMOBILE=y
 CONFIG_SYS_TEXT_BASE=0x50000000
configs/r8a774b1_beacon_defconfig +1 -0
index ca514bb1aa..b7d7f23f5a 100644
@@ -1,3 +1,4 @@
+CONFIG_LTO=y
 CONFIG_ARM=y
 CONFIG_ARCH_RMOBILE=y
 CONFIG_SYS_TEXT_BASE=0x50000000
configs/r8a774e1_beacon_defconfig +1 -0
index b89729d92a..3e44edf29f 100644
@@ -1,3 +1,4 @@
+CONFIG_LTO=y
 CONFIG_ARM=y
 CONFIG_ARCH_RMOBILE=y
 CONFIG_SYS_TEXT_BASE=0x50000000
configs/turris_mox_defconfig +1 -0
index f938fbb475..2a351d9180 100644
@@ -1,3 +1,4 @@
+CONFIG_LTO=y
 CONFIG_ARM=y
 CONFIG_ARCH_CPU_INIT=y
 CONFIG_ARCH_MVEBU=y
configs/turris_omnia_defconfig +1 -1
index 4b8843d7be..d7a2ec3592 100644
@@ -1,3 +1,4 @@    
+CONFIG_LTO=y>>>  CONFIG_ARM=y    
 CONFIG_ARCH_CPU_INIT=y
 CONFIG_SPL_SYS_THUMB_BUILD=y
--
Quoted 2 lines

2.26.2

Marek,

Perhaps I didn't test the property test before as I did not realize there was a config to be enabled.

Enabling CONFIG_LTO breaks linking the SPL (linking uboot is fine):
LTO spl/u-boot-spl
make[2]: *** read jobs pipe: No such file or directory. Stop.
make[2]: *** Waiting for unfinished jobs....
lto-wrapper: fatal error: make returned 2 exit status
compilation terminated. /usr/src/venice/buildroot/output/host/lib/gcc/aarch64-buildroot-linux-gnu/9.3.0/../../../../aarch64-buildroot-linux-gnu/bin/ld:
error: lto-wrapper failed
collect2: error: ld returned 1 exit status
scripts/Makefile.spl:461: recipe for target 'spl/u-boot-spl' failed
make[1]: *** [spl/u-boot-spl] Error 1
Makefile:1985: recipe for target 'spl/u-boot-spl' failed
make: *** [spl/u-boot-spl] Error 2

Quoted 5 lines

I'm using your lto branch

Best Regards,

Tim

Tim, try compiling with only one job, i.e.
make -j1

Quoted 5 lines
Quoted 2 lines

If parallel build fails, we have a bug in the Makefile. It worked fine without the LTO patches.

It may be a problem with GNU make's jobserver. Tom mentioned that there is a known race condition or something...

I was unclear at the time, sorry. Yes, it sounds like there's some race condition these patches are adding that needs to be addressed. By the nature of race condition they aren't always easy to trigger, but we can't just ignore them if CI doesn't trip on it every time.

Quoted 4 lines

If only there was a simple way to discover inside the Makefile the number of jobs given to the make command via the -j parameter, we could use -flto=$(JOBS).

Quoted 8 lines
Quoted 2 lines

I found this
https://blog.jgc.org/2015/03/gnu-make-insanity-finding-value-of-j.html

Well, how is this being done in the Linux kernel? Or maybe, sigh, this isn't a problem with Clang's LTO which is what is in mainline Linux kernel atm. Maybe
https://lore.kernel.org/patchwork/project/lkml/list/?series=463749&state=*
will have some clues, all the same.

Quoted 8 lines

Tom, I fear that the only stable and sane solution now is to drop jobserver and just do -flto, i.e. in one thread. This will increase compilation time, but will work for everyone.

Another option is to do -flto=NCPUs, but that would contradict user's choice of -j option, if they chose -j1, for example.

What do you think?

Maybe we do NCPUs and have the help text note this particular quirk for now?

Signature · 8 lines
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/20210315/23806a45/attachment.sig>
#12 lore raw

PATCH 38/38 ARM: enable LTO for some boards

Quoted 244 lines · On Mon, 15 Mar 2021 21:12:32 -0400 Tom Rini <[email protected]> wrote:
Quoted 243 lines · Marek Behun
Quoted 227 lines · On Fri, 12 Mar 2021 15:47:12 -0500 Tom Rini <[email protected]> wrote:
Quoted 211 lines · Marek Behun
Quoted 208 lines · On Fri, 12 Mar 2021 18:19:08 +0100 Heinrich Schuchardt <[email protected]>…
Quoted 206 lines · Marek Behun
Quoted 194 lines · On Fri, 12 Mar 2021 08:34:41 -0800 Tim Harvey <[email protected]> wrote:
Quoted 171 lines · Marek Beh?n

Enable LTO for some boards that were tested by people on U-Boot Mailing List.

---
 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 +
 configs/turris_mox_defconfig          | 1 +
 configs/turris_omnia_defconfig        | 1 +
 16 files changed, 16 insertions(+)
configs/am3517_evm_defconfig +1 -0
index bae0e0af35..d61eec94a4 100644
@@ -1,3 +1,4 @@
+CONFIG_LTO=y
 CONFIG_ARM=y
 # CONFIG_SPL_USE_ARCH_MEMCPY is not set
 # CONFIG_SPL_USE_ARCH_MEMSET is not set
configs/da850evm_defconfig +1 -0
index 26e76a2929..6ff5e21bc6 100644
@@ -1,3 +1,4 @@
+CONFIG_LTO=y
 CONFIG_ARM=y
 CONFIG_SYS_THUMB_BUILD=y
 CONFIG_ARCH_DAVINCI=y
configs/da850evm_direct_nor_defconfig +1 -0
index d3860a963d..06c7ce7c47 100644
@@ -1,3 +1,4 @@
+CONFIG_LTO=y
 CONFIG_ARM=y
 CONFIG_ARCH_CPU_INIT=y
 CONFIG_ARCH_DAVINCI=y
configs/da850evm_nand_defconfig +1 -0
index 0d0e9a148d..be737564e1 100644
@@ -1,3 +1,4 @@
+CONFIG_LTO=y
 CONFIG_ARM=y
 CONFIG_SYS_THUMB_BUILD=y
 CONFIG_ARCH_DAVINCI=y
configs/imx6q_logic_defconfig +1 -0
index 36dc24d080..0f8aea6983 100644
@@ -1,3 +1,4 @@
+CONFIG_LTO=y
 CONFIG_ARM=y
 CONFIG_ARCH_MX6=y
 CONFIG_SYS_TEXT_BASE=0x17800000
configs/imx8mm_beacon_defconfig +1 -0
index 045b19f4f3..e8bb44eea6 100644
@@ -1,3 +1,4 @@
+CONFIG_LTO=y
 CONFIG_ARM=y
 CONFIG_ARCH_IMX8M=y
 CONFIG_SYS_TEXT_BASE=0x40200000
configs/imx8mm_venice_defconfig +1 -0
index a15c3641f6..dff8f64540 100644
@@ -1,3 +1,4 @@
+CONFIG_LTO=y
 CONFIG_ARM=y
 CONFIG_ARCH_IMX8M=y
 CONFIG_SYS_TEXT_BASE=0x40200000
configs/imx8mn_beacon_2g_defconfig +1 -0
index 58b8e49486..1c8cbc2c89 100644
@@ -1,3 +1,4 @@
+CONFIG_LTO=y
 CONFIG_ARM=y
 CONFIG_ARCH_IMX8M=y
 CONFIG_SYS_TEXT_BASE=0x40200000
configs/imx8mn_beacon_defconfig +1 -0
index d6a3385d8d..6457b9409a 100644
@@ -1,3 +1,4 @@
+CONFIG_LTO=y
 CONFIG_ARM=y
 CONFIG_ARCH_IMX8M=y
 CONFIG_SYS_TEXT_BASE=0x40200000
configs/nokia_rx51_defconfig +1 -0
index 312ca3a1a9..85ca627790 100644
@@ -1,3 +1,4 @@
+CONFIG_LTO=y
 CONFIG_ARM=y
 # CONFIG_SYS_THUMB_BUILD is not set
 CONFIG_ARCH_OMAP2PLUS=y
configs/omap3_logic_defconfig +1 -0
index 4e37237b86..cc4b727a2c 100644
@@ -1,3 +1,4 @@
+CONFIG_LTO=y
 CONFIG_ARM=y
 # CONFIG_SPL_USE_ARCH_MEMCPY is not set
 # CONFIG_SPL_USE_ARCH_MEMSET is not set
configs/r8a774a1_beacon_defconfig +1 -0
index 2f45edd92e..9dd5d9192e 100644
@@ -1,3 +1,4 @@
+CONFIG_LTO=y
 CONFIG_ARM=y
 CONFIG_ARCH_RMOBILE=y
 CONFIG_SYS_TEXT_BASE=0x50000000
configs/r8a774b1_beacon_defconfig +1 -0
index ca514bb1aa..b7d7f23f5a 100644
@@ -1,3 +1,4 @@
+CONFIG_LTO=y
 CONFIG_ARM=y
 CONFIG_ARCH_RMOBILE=y
 CONFIG_SYS_TEXT_BASE=0x50000000
configs/r8a774e1_beacon_defconfig +1 -0
index b89729d92a..3e44edf29f 100644
@@ -1,3 +1,4 @@
+CONFIG_LTO=y
 CONFIG_ARM=y
 CONFIG_ARCH_RMOBILE=y
 CONFIG_SYS_TEXT_BASE=0x50000000
configs/turris_mox_defconfig +1 -0
index f938fbb475..2a351d9180 100644
@@ -1,3 +1,4 @@
+CONFIG_LTO=y
 CONFIG_ARM=y
 CONFIG_ARCH_CPU_INIT=y
 CONFIG_ARCH_MVEBU=y
configs/turris_omnia_defconfig +1 -1
index 4b8843d7be..d7a2ec3592 100644
@@ -1,3 +1,4 @@      
+CONFIG_LTO=y>>>  CONFIG_ARM=y      
 CONFIG_ARCH_CPU_INIT=y
 CONFIG_SPL_SYS_THUMB_BUILD=y
--
Quoted 2 lines

2.26.2

Marek,

Perhaps I didn't test the property test before as I did not realize there was a config to be enabled.

Enabling CONFIG_LTO breaks linking the SPL (linking uboot is fine):
LTO spl/u-boot-spl
make[2]: *** read jobs pipe: No such file or directory. Stop.
make[2]: *** Waiting for unfinished jobs....
lto-wrapper: fatal error: make returned 2 exit status
compilation terminated. /usr/src/venice/buildroot/output/host/lib/gcc/aarch64-buildroot-linux-gnu/9.3.0/../../../../aarch64-buildroot-linux-gnu/bin/ld:
error: lto-wrapper failed
collect2: error: ld returned 1 exit status
scripts/Makefile.spl:461: recipe for target 'spl/u-boot-spl' failed
make[1]: *** [spl/u-boot-spl] Error 1
Makefile:1985: recipe for target 'spl/u-boot-spl' failed
make: *** [spl/u-boot-spl] Error 2

Quoted 5 lines

I'm using your lto branch

Best Regards,

Tim

Tim, try compiling with only one job, i.e.
make -j1

Quoted 5 lines
Quoted 2 lines

If parallel build fails, we have a bug in the Makefile. It worked fine without the LTO patches.

It may be a problem with GNU make's jobserver. Tom mentioned that there is a known race condition or something...

I was unclear at the time, sorry. Yes, it sounds like there's some race condition these patches are adding that needs to be addressed. By the nature of race condition they aren't always easy to trigger, but we can't just ignore them if CI doesn't trip on it every time.

Quoted 4 lines

If only there was a simple way to discover inside the Makefile the number of jobs given to the make command via the -j parameter, we could use -flto=$(JOBS).

Quoted 8 lines
Quoted 2 lines

I found this
https://blog.jgc.org/2015/03/gnu-make-insanity-finding-value-of-j.html

Well, how is this being done in the Linux kernel? Or maybe, sigh, this isn't a problem with Clang's LTO which is what is in mainline Linux kernel atm. Maybe
https://lore.kernel.org/patchwork/project/lkml/list/?series=463749&state=*
will have some clues, all the same.

Tom, I fear that the only stable and sane solution now is to drop jobserver and just do -flto, i.e. in one thread. This will increase compilation time, but will work for everyone.

Quoted 8 lines
Quoted 4 lines

Another option is to do -flto=NCPUs, but that would contradict user's choice of -j option, if they chose -j1, for example.

What do you think?

Maybe we do NCPUs and have the help text note this particular quirk for now?

OK