With LTO, SPL, TPL and VPL are linked through the compiler driver, and
GCC's lto-wrapper runs code generation through make. The link recipe
is not marked recursive, so make does not pass its jobserver to that
command.

With Debian's GCC 12.2 and make 4.3, the SPL link of turris_1x_sdcard,
which the next patch switches to LTO, therefore fails at -j8:

  make[3]: *** write jobserver: Bad file descriptor.  Stop.
  lto-wrapper: fatal error: make returned 2 exit status

Prefix the recipe with '+', as the top-level U-Boot link rule does.

Tested with Debian's GCC 12.2, where the link now succeeds, and GCC
14.2, where '+' does not change the images of three mpc85xx LTO
builds.

Signed-off-by: Josef Schlehofer <[email protected]>
Cc: Tom Rini <[email protected]>
Cc: Simon Glass <[email protected]>
Cc: Marek BehĂșn <[email protected]>
---
Changes in v2:
- shorter commit message

With Debian's GCC 14.2.0-19, the link also succeeds without '+' at
-j8. The LTO images of turris_1x_sdcard, P2020RDB-PC_NAND and
T2080RDB_NAND are identical with and without it.
---
 scripts/Makefile.xpl | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/scripts/Makefile.xpl b/scripts/Makefile.xpl
index dfd76b51a61..926d762108f 100644
--- a/scripts/Makefile.xpl
+++ b/scripts/Makefile.xpl
@@ -544,7 +544,7 @@ endif
 $(obj)/$(SPL_BIN): $(u-boot-spl-platdata) $(u-boot-spl-init) \
                $(u-boot-spl-main) $(u-boot-spl-keep-syms-lto) \
                $(obj)/u-boot-spl.lds FORCE
-       $(call if_changed,u-boot-spl)
+       +$(call if_changed,u-boot-spl)
 
 $(sort $(u-boot-spl-init) $(u-boot-spl-main)): $(u-boot-spl-dirs) ;
 
-- 
2.54.0 (Apple Git-157)

Reply via email to