arm: Use DWARF numbering convention for pseudo-register representation
authorVictor Do Nascimento <Victor.DoNascimento@arm.com>
Mon, 1 Aug 2022 21:07:27 +0000 (22:07 +0100)
committerTamar Christina <tamar.christina@arm.com>
Tue, 2 Aug 2022 08:20:48 +0000 (09:20 +0100)
commit3a368c4c248f6e9f4bda3a5369befa17a4560293
treec18db09aa5561fca5f0ae4952baf02a00683c3c1
parent217cbb0055391809d6dfb56cec053fdd3cf08b75
arm: Use DWARF numbering convention for pseudo-register representation

This patch modifies the internal `struct reg_entry' numbering of DWARF
pseudo-registers to match values assigned in DWARF standards (see "4.1
DWARF register names" in [1])so ra_auth_code goes from 12 to 143 and
amends the unwinder .save directive-processing code to correctly handle
mixed register-type save directives.

The mechanism for splitting the register list is also re-written to
comply with register ordering on push statements, being that registers
are stored on the stack in numerical order, with the lowest numbered
register at the lowest address [2].

Consequently, the parsing of the hypothetical directive

        .save{r4-r7, r10, ra_auth_core, lr}

has been changed such as rather than producing

        .save{r4-r7, r10}
        .save{ra_auth_code}
        .save{lr}

as was the case with previous implementation, now produces:

        .save{lr}
        .save{ra_auth_code}
        .save{r4-r7, r10}

[1] <https://github.com/ARM-software/abi-aa/blob/main/aadwarf32/aadwarf32.rst>
[2] <https://developer.arm.com/documentation/dui0473/j/arm-and-thumb-instructions/push>

gas/Changelog:

* config/tc-arm.c (REG_RA_AUTH_CODE): New.
(parse_dot_save): Likewise.
(parse_reg_list): Remove obsolete code.
(reg_names): Set ra_auth_code to 143.
(s_arm_unwind_save): Handle core and pseudo-register lists via
parse_dot_save.
(s_arm_unwind_save_mixed): Deleted.
(s_arm_unwind_save_pseudo): Handle one register at a time.
* testsuite/gas/arm/unwind-pacbti-m-readelf.d: Fix test.
* testsuite/gas/arm/unwind-pacbti-m.d: Likewise.
gas/config/tc-arm.c
gas/testsuite/gas/arm/unwind-pacbti-m-readelf.d
gas/testsuite/gas/arm/unwind-pacbti-m.d