[binutils-gdb] s390: gas: Remove support for register names "ap" and "cc" in CFI directives

Jens Remus jremus@sourceware.org
Tue Jan 20 09:34:41 GMT 2026


https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=9f49864306296bd9afcb59bf4baa433913430413

commit 9f49864306296bd9afcb59bf4baa433913430413
Author: Jens Remus <jremus@linux.ibm.com>
Date:   Tue Jan 20 10:33:56 2026 +0100

    s390: gas: Remove support for register names "ap" and "cc" in CFI directives
    
    The assembler erroneously converted the special register names "ap" and
    "cc" to the DWARF register numbers 32 and 33 respectively, which are
    actually assigned to the control registers c0 and c1 according to both
    the s390 32-bit (s390) ELF ABI [1] and s390 64-bit (s390x) ELF ABI [2].
    
    Register numbers 32 and 33 are used internally by GCC as "argument
    pointer" (ap) and "condition code" (cc).  Very early GCC versions leaked
    this out into DWARF.  However, those GCC-internal special register names
    should never be actually used in CFI, especially given their resulting
    DWARF register numbers have a different meaning in DWARF (CFI).
    
    [1]: s390 ELF ABI, section "DWARF definition",
         https://refspecs.linuxbase.org/ELF/zSeries/lzsabi0_s390.html
    [2]: s390x ELF ABI, subsection "DWARF Register Numbers",
         https://github.com/IBM/s390x-abi/releases
    
    gas/
            * config/tc-s390.c (tc_s390_regname_to_dw2regnum): Remove
            support for register names "ap" and "cc" in CFI directives.
    
    Suggested-by: Ulrich Weigand <ulrich.weigand@de.ibm.com>
    Signed-off-by: Jens Remus <jremus@linux.ibm.com>

Diff:
---
 gas/config/tc-s390.c | 4 ----
 1 file changed, 4 deletions(-)

diff --git a/gas/config/tc-s390.c b/gas/config/tc-s390.c
index bcbe5c52f3a..26a782baaa3 100644
--- a/gas/config/tc-s390.c
+++ b/gas/config/tc-s390.c
@@ -2897,10 +2897,6 @@ tc_s390_regname_to_dw2regnum (char *regname)
 	  regnum += 48;
 	}
     }
-  else if (strcmp (regname, "ap") == 0)
-    regnum = 32;
-  else if (strcmp (regname, "cc") == 0)
-    regnum = 33;
   return regnum;
 }


More information about the Binutils-cvs mailing list