From 736c00fa02e0e43eebf545edd99948ca56c03ee9 Mon Sep 17 00:00:00 2001
From: Jim Meyering <meyering@meta.com>
Date: Thu, 3 Sep 2026 12:06:06 -0700
Subject: [PATCH] gzip: fix s390 build failure with -m31

* dfltcc.c (is_dfltcc_enabled): Use the STFLE opcode rather than the
mnemonic, as Linux does: with 'gcc -m31' the assembler's default
machine predates z9-109, so it rejects the mnemonic.
Reported by Bruno Haible in https://bugs.gnu.org/81766
---
 dfltcc.c | 14 ++------------
 1 file changed, 2 insertions(+), 12 deletions(-)

diff --git a/dfltcc.c b/dfltcc.c
index ccc4a8d..6730cbf 100644
--- a/dfltcc.c
+++ b/dfltcc.c
@@ -155,18 +155,8 @@ is_dfltcc_enabled (void)

   memset (facilities, 0, sizeof facilities);
   register char r0 __asm__ ("r0") = sizeof facilities / 8 - 1;
-  /* STFLE is supported since z9-109 and only in z/Architecture mode.  When
-   * compiling with -m31, gcc defaults to ESA mode, however, since the kernel
-   * is 64-bit, it's always z/Architecture mode at runtime.  */
-  __asm__ (
-#ifndef __clang__
-           ".machinemode push\n"
-           ".machinemode zarch\n"
-#endif
-           "stfle %[facilities]\n"
-#ifndef __clang__
-           ".machinemode pop\n"
-#endif
+  /* Using the raw opcode is more portable than the STFLE mnemonic. */
+  __asm__ (".insn s,0xb2b00000,%[facilities]\n" /* stfle */
            : [facilities] "=Q"(facilities), [r0] "+r"(r0) :: "cc");
   return is_bit_set (facilities, DFLTCC_FACILITY);
 }
-- 
2.55.0

