[PATCH v2 4/4] s390: gas: Remove support for register names "ap" and "cc" in CFI directives
Andreas Krebbel
krebbel@linux.ibm.com
Mon Jan 19 21:00:43 GMT 2026
On 1/19/26 4:59 PM, Jens Remus wrote:
> 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.
Ok. Thanks!
Andreas
>
> Suggested-by: Ulrich Weigand <ulrich.weigand@de.ibm.com>
> Signed-off-by: Jens Remus <jremus@linux.ibm.com>
> ---
> 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 bcbe5c52f3a7..26a782baaa36 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
mailing list