The LTO link rules put $(PLATFORM_LIBS) inside --whole-archive. This
works with U-Boot's private libgcc, but pulls every member of a
toolchain libgcc into the link. With Debian's GCC 14.2, turris_1x_nor
fails to link with CONFIG_LTO=y: ld rejects the hard-float members in
this soft-float build, while other members reference __morestack_fail,
__tls_get_addr or __SDATA_START__.

Select USE_PRIVATE_LIBGCC for mpc85xx LTO builds. The previous two
patches add the routines it was missing. This has no effect until a
later patch allows LTO on mpc85xx.

Signed-off-by: Josef Schlehofer <[email protected]>
Cc: Tom Rini <[email protected]>
Cc: Marek BehĂșn <[email protected]>
Cc: Priyanka Jain <[email protected]>
---
Changes in v2:
- new patch, instead of "Makefile: Link a toolchain libgcc outside
  --whole-archive with LTO"

With the whole series, all 71 mpc85xx defconfigs link with
CONFIG_LTO=y.
---
 arch/powerpc/Kconfig | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
index f20d58b4de6..b4883e00458 100644
--- a/arch/powerpc/Kconfig
+++ b/arch/powerpc/Kconfig
@@ -21,6 +21,7 @@ config MPC85xx
        select SYS_FSL_DDR
        select SYS_FSL_DDR_BE
        select SYS_FSL_IFC_BE
+       select USE_PRIVATE_LIBGCC if LTO
        select BINMAN if MPC85XX_HAVE_RESET_VECTOR && OF_SEPARATE
        imply CMD_HASH
        imply CMD_IRQ
-- 
2.54.0 (Apple Git-157)

Reply via email to