toolchain: introduce BR2_TOOLCHAIN_HAS_GCC_BUG_104820
PATCH 1/2 toolchain: introduce BR2_TOOLCHAIN_HAS_GCC_BUG_104820
-fzero-call-used-regs is broken on MIPS before R6, which still has the hi/lo registers: gcc either rejects -fzero-call-used-regs=used for functions using them:
sorry, unimplemented: argument 'used' is not supported for '-fzero-call-used-regs' on this target
or, depending on the code, the ABI and the optimization level, ICEs:
during RTL pass: zero_call_used_regs
channels.c:437:1: internal compiler error: in int_mode_for_mode, at stor-layout.cc:408
This has been reported upstream, and is still present in gcc 15.3.0:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104820
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104817
MIPS R6 doesn't have hi/lo and is not affected.
--- toolchain/Config.in | 10 ++++++++++ 1 file changed, 10 insertions(+)
toolchain/Config.in +10 -0
@@ -210,6 +210,16 @@ config BR2_TOOLCHAIN_HAS_GCC_BUG_104028 bool default y if BR2_m68k +# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104820 +# ICE: on MIPS: in int_mode_for_mode, at stor-layout.cc:408 during +# RTL pass: zero_call_used_regs. MIPS before R6 also rejects +# -fzero-call-used-regs=used in functions using the hi/lo registers. +# This bug still exists in gcc = 15.3.0 +config BR2_TOOLCHAIN_HAS_GCC_BUG_104820 + bool + default y if (BR2_mips || BR2_mipsel || BR2_mips64 || BR2_mips64el) \ + && !BR2_MIPS_CPU_MIPS32R6 && !BR2_MIPS_CPU_MIPS64R6 + # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107728 # https://sourceware.org/bugzilla/show_bug.cgi?id=29621 config BR2_TOOLCHAIN_HAS_GCC_BUG_107728
Signature · 6 lines
2.34.1 _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
PATCH 2/2 package/openssh: fix build on MIPS before R6 at -O0
openssh fails to build on MIPS64 (n32/n64 ABI) before R6 with BR2_OPTIMIZE_0:
during RTL pass: zero_call_used_regs
channels.c: In function 'channel_set_xtype':
channels.c:437:1: internal compiler error: in int_mode_for_mode, at stor-layout.cc:408
Since version 9.6p1, openssh builds with -fzero-call-used-regs=used if the compiler supports it. On MIPS before R6, gcc rejects this option or ICEs on functions using the hi/lo registers (gcc bug 104820). The configure check usually catches this, but at -O0 its test program builds fine with n32/n64, so the option ends up being used.
Disable -fzero-call-used-regs on MIPS before R6, through the configure cache variable already used for powerpc64le. This doesn't lose anything, as the option is never usable there.
This issue has been present since commit 3c047ea463e2 ("package/openssh: security bump to version 9.6p1"), which switched from -fzero-call-used-regs=all (always rejected by the configure check on MIPS before R6) to -fzero-call-used-regs=used. It therefore affects 2024.02 and later, including all maintained branches. The cache variable only exists since openssh 10.1, so for branches with an older openssh, --without-hardening would be needed instead.
Fixes:
https://autobuild.buildroot.org/results/68d260341341afb0dfb7244f641f5196df3649a8
--- package/openssh/openssh.mk | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
package/openssh/openssh.mk +3 -1
@@ -36,7 +36,9 @@ define OPENSSH_PERMISSIONS /var/empty d 755 root root - - - - - endef -ifeq ($(BR2_powerpc64le),y) +# -fzero-call-used-regs=used is not supported on powerpc64le and makes +# gcc ICE on MIPS before R6 +ifneq ($(BR2_powerpc64le)$(BR2_TOOLCHAIN_HAS_GCC_BUG_104820),) OPENSSH_CONF_ENV += ossh_cv_cflag__fzero_call_used_regs_used=no endif
Signature · 6 lines
2.34.1 _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
Raphaël Mélotte via buildroot
AppliedRe: [Buildroot] [PATCH 2/2] package/openssh: fix build on MIPS before R6 at -O0
In reply of:
Quoted 25 lines
openssh fails to build on MIPS64 (n32/n64 ABI) before R6 with
BR2_OPTIMIZE_0:during RTL pass:
zero_call_used_regs
channels.c: In function 'channel_set_xtype':
channels.c:437:1: internal compiler error: inint_mode_for_mode, at stor-layout.cc:408Since version 9.6p1, openssh builds with -fzero-call-used-regs=used if the compiler supports it. On MIPS before R6, gcc rejects this option or ICEs on functions using the hi/lo registers (gcc bug 104820). The configure check usually catches this, but at -O0 its test program builds fine with n32/n64, so the option ends up being used.
Disable -fzero-call-used-regs on MIPS before R6, through the configure cache variable already used for powerpc64le. This doesn't lose anything, as the option is never usable there.
This issue has been present since commit
3c047ea463e2("package/openssh: security bump to version 9.6p1"), which switched from -fzero-call-used-regs=all (always rejected by the configure check on MIPS before R6) to -fzero-call-used-regs=used. It therefore affects 2024.02 and later, including all maintained branches. The cache variable only exists since openssh 10.1, so for branches with an older openssh, --without-hardening would be needed instead.
Quoted 6 lines
Fixes:
https://autobuild.buildroot.org/results/68d260341341afb0dfb7244f641f5196df3649a8Fixes 3c047ea463e27ceaafde76d64406862c3322daa0 ("package/openssh: security bump to version 9.6p1")Assisted-by Claude:claude-opus-5-5Signed-off-by Yegor Yefremov <[email protected]>
Applied to 2025.02.x, 2026.08.x. Thanks
Quoted 9 lines
--- package/openssh/openssh.mk | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)package/openssh/openssh.mk +0
-0
package/openssh/openssh.mk define OPENSSH_PERMISSIONS · line 44
Quoted 10 lines
package/openssh/openssh.mk +3
-1@@ -36,7 +36,9 @@ define OPENSSH_PERMISSIONS /var/empty d 755 root root - - - - - endef -ifeq ($(BR2_powerpc64le),y) +# -fzero-call-used-regs=used is not supported on powerpc64le and makes +# gcc ICE on MIPS before R6 +ifneq ($(BR2_powerpc64le)$(BR2_TOOLCHAIN_HAS_GCC_BUG_104820),) OPENSSH_CONF_ENV += ossh_cv_cflag__fzero_call_used_regs_used=no endif
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
Quoted 11 lines · Yegor Yefremov
-fzero-call-used-regs is broken on MIPS before R6, which still has the hi/lo registers: gcc either rejects -fzero-call-used-regs=used for functions using them:
sorry, unimplemented: argument 'used' is not supported for '-fzero-call-used-regs' on this target
or, depending on the code, the ABI and the optimization level, ICEs:
during RTL pass:
zero_call_used_regs
channels.c:437:1: internal compiler error: inint_mode_for_mode, at stor-layout.cc:408
Quoted 8 lines
This has been reported upstream, and is still present in gcc 15.3.0:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104820
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104817MIPS R6 doesn't have hi/lo and is not affected.
Assisted-by Claude:claude-opus-5-5Signed-off-by Yegor Yefremov <[email protected]>
Series applied to master, thanks!
Best regards,
Thomas Petazzoni
Signature · 7 lines
Thomas Petazzoni, co-owner and CEO, Bootlin Embedded Linux and Kernel engineering and training https://bootlin.com _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
Raphaël Mélotte via buildroot
AppliedIn reply of:
Quoted 11 lines
-fzero-call-used-regs is broken on MIPS before R6, which still has the hi/lo registers: gcc either rejects -fzero-call-used-regs=used for functions using them:
sorry, unimplemented: argument 'used' is not supported for '-fzero-call-used-regs' on this target
or, depending on the code, the ABI and the optimization level, ICEs:
during RTL pass:
zero_call_used_regs
channels.c:437:1: internal compiler error: inint_mode_for_mode, at stor-layout.cc:408
Quoted 8 lines
This has been reported upstream, and is still present in gcc 15.3.0:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104820
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104817MIPS R6 doesn't have hi/lo and is not affected.
Assisted-by Claude:claude-opus-5-5Signed-off-by Yegor Yefremov <[email protected]>
Applied to 2025.02.x, 2026.08.x. Thanks
Quoted 15 lines
--- toolchain/Config.in | 10 ++++++++++ 1 file changed, 10 insertions(+)toolchain/Config.in +3
-0@@ -210,6 +210,16 @@ config BR2_TOOLCHAIN_HAS_GCC_BUG_104028 bool default y if BR2_m68k +# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104820 +# ICE: on MIPS: in int_mode_for_mode, at stor-layout.cc:408 during +# RTL pass: zero_call_used_regs. MIPS before R6 also rejects
toolchain/Config.in config BR2_TOOLCHAIN_HAS_GCC_BUG_104028 · line 225
Quoted 10 lines
toolchain/Config.in +7
-0+# -fzero-call-used-regs=used in functions using the hi/lo registers. +# This bug still exists in gcc = 15.3.0 +config BR2_TOOLCHAIN_HAS_GCC_BUG_104820 + bool + default y if (BR2_mips || BR2_mipsel || BR2_mips64 || BR2_mips64el) \ + && !BR2_MIPS_CPU_MIPS32R6 && !BR2_MIPS_CPU_MIPS64R6 + # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107728 # https://sourceware.org/bugzilla/show_bug.cgi?id=29621 config BR2_TOOLCHAIN_HAS_GCC_BUG_107728
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot