Skip to contentSkip to conversation

package/openssh: fix build with -fzero-call-used-regs on ARM Thumb-1

PATCH Applied Yegor Yefremov via buildroot 1 participant 2 messages Nov 5 – Nov 16

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 package/openssh: fix build with -fzero-call-used-regs on ARM Thumb-1

Since OpenSSH 9.6p1, configure enables -fzero-call-used-regs=used with GCC when the compiler accepts it. On ARM cores that only support Thumb-1 (e.g. ARM926EJ-S) built in Thumb mode, GCC accepts the flag, but fails on some functions:

xcrypt.c: In function 'shadow_pw':
xcrypt.c:156:1: sorry, unimplemented: argument 'used' is not supported for '-fzero-call-used-regs' on this target

The ARM backend relies on GCC's generic register zeroing, which loads zero into each register to clear. Thumb-1 cannot move an immediate into a high register (ip, lr), so it falls back to copying from an already zeroed low register. In functions where the only call-used registers to clear are high registers, there is none to copy from and GCC gives up. -fzero-call-used-regs=all, ARM mode and Thumb-2 all work.

Disable the flag on Thumb-1 by presetting the configure cache variable, as already done for powerpc64le and MIPS before R6.

This issue has been present since commit 3c047ea463e2 ("package/openssh:
security bump to version 9.6p1"), as OpenSSH 9.6p1 switched GCC builds from -fzero-call-used-regs=all to -fzero-call-used-regs=used. It therefore affects 2024.02 and later, including 2025.02.x.

Fixes:
https://autobuild.buildroot.org/results/6b064db6d713a6fef7f202c37daf041055e647ef

Fixes 3c047ea463e27ceaafde76d64406862c3322daa0 ("package/openssh: security bump to version 9.6p1")
Assisted-by Claude:claude-opus-5-5
---
 package/openssh/openssh.mk | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
package/openssh/openssh.mk +3 -3
index a0cd3168e0..27cd5fb169 100644
@@ -36,9 +36,9 @@ define OPENSSH_PERMISSIONS
 	/var/empty d 755 root root - - - - -
 endef
 
-# -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),)
+# -fzero-call-used-regs=used is not supported on powerpc64le and ARM
+# Thumb-1, and makes gcc ICE on MIPS before R6
+ifneq ($(BR2_powerpc64le)$(BR2_ARM_INSTRUCTIONS_THUMB)$(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
#1 lore raw

In reply of:

Quoted 24 lines

Since OpenSSH 9.6p1, configure enables -fzero-call-used-regs=used with GCC when the compiler accepts it. On ARM cores that only support Thumb-1 (e.g. ARM926EJ-S) built in Thumb mode, GCC accepts the flag, but fails on some functions:

xcrypt.c: In function 'shadow_pw':
xcrypt.c:156:1: sorry, unimplemented: argument 'used' is not supported for '-fzero-call-used-regs' on this target

The ARM backend relies on GCC's generic register zeroing, which loads zero into each register to clear. Thumb-1 cannot move an immediate into a high register (ip, lr), so it falls back to copying from an already zeroed low register. In functions where the only call-used registers to clear are high registers, there is none to copy from and GCC gives up. -fzero-call-used-regs=all, ARM mode and Thumb-2 all work.

Disable the flag on Thumb-1 by presetting the configure cache variable, as already done for powerpc64le and MIPS before R6.

This issue has been present since commit 3c047ea463e2 ("package/openssh:
security bump to version 9.6p1"), as OpenSSH 9.6p1 switched GCC builds from -fzero-call-used-regs=all to -fzero-call-used-regs=used. It therefore affects 2024.02 and later, including 2025.02.x.

Quoted 6 lines

Fixes:
https://autobuild.buildroot.org/results/6b064db6d713a6fef7f202c37daf041055e647ef

Fixes 3c047ea463e27ceaafde76d64406862c3322daa0 ("package/openssh: security bump to version 9.6p1")
Assisted-by Claude:claude-opus-5-5

Applied to 2025.02.x, 2026.08.x. Thanks

Quoted 11 lines
---
 package/openssh/openssh.mk | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
package/openssh/openssh.mk +0 -0
index a0cd3168e0..27cd5fb169 100644
@@ -36,9 +36,9 @@ define OPENSSH_PERMISSIONS
 	/var/empty d 755 root root - - - - -
 endef

package/openssh/openssh.mk define OPENSSH_PERMISSIONS · line 44

Quoted 10 lines
package/openssh/openssh.mk +3 -3
 
-# -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),)
+# -fzero-call-used-regs=used is not supported on powerpc64le and ARM
+# Thumb-1, and makes gcc ICE on MIPS before R6
+ifneq ($(BR2_powerpc64le)$(BR2_ARM_INSTRUCTIONS_THUMB)$(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