]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
s390: gas: Remove support for register names "ap" and "cc" in CFI directives
authorJens Remus <jremus@linux.ibm.com>
Tue, 20 Jan 2026 09:33:56 +0000 (10:33 +0100)
committerJens Remus <jremus@linux.ibm.com>
Tue, 20 Jan 2026 09:33:56 +0000 (10:33 +0100)
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>
gas/config/tc-s390.c

index bcbe5c52f3a70ea66c39d5770faa99d23d18c34a..26a782baaa36cb30e32427924eebe5952ab0629c 100644 (file)
@@ -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;
 }