[PATCH 0/9] DWARF Register Number Handling, Including RISC-V CSRs

Andrew Burgess andrew.burgess@embecosm.com
Fri Nov 22 12:10:00 GMT 2019


The aim of this series is to provide support for using RISC-V CSRs
(Control Status Registers) in gas .cfi directives.  The problem with
this is that the DWARF register numbers for these registers are rather
large, in the range 4096 - 8191, and the number space is only sparsely
populated.  The existing code for mapping DWARF register numbers to
names is not really setup to handle this situation, and additionally,
the default DWARF CIE version that gas uses only has a single byte
return address column, which is overflowed by these CSRs.

This series starts with some general code clean up (I think) in the
area around DWARF register number handling, introduces a new mechanism
for mapping from DWARF register numbers to names, and then adds
support for RISC-V CSRs.  Finally I make DWARF CIE version 3 the
default for RISC-V, this should be largely invisible to consumers,
except the return address column is now uleb128 instead of ubyte.

---

Andrew Burgess (9):
  gas/riscv: Remove unneeded structure
  binutils: Be more forgiving of targets with large numbers of registers
  binutils: Rename init_dwarf_regnames
  binutils: Add a new function to initialise DWARF register name state
  binutils: Make some functions static in dwarf.c
  binutils: Make DWARF register name lookup be via a function pointer
  binutils/gas/riscv: Add DWARF register numbers for CSRs
  gas: Check for overflow on return column in version 1 CIE DWARF
  gas/riscv: Produce version 3 DWARF CIE by default

 binutils/ChangeLog                            |  59 ++++++
 binutils/dwarf.c                              | 143 ++++++++++++--
 binutils/dwarf.h                              |  10 +-
 binutils/objdump.c                            |  40 +---
 binutils/readelf.c                            |   2 +-
 gas/ChangeLog                                 |  30 +++
 gas/as.c                                      |  10 +-
 gas/config/tc-riscv.c                         |  18 +-
 gas/dw2gencfi.c                               |   7 +-
 gas/dwarf2dbg.c                               |  11 ++
 gas/testsuite/gas/riscv/cie-rtn-col-1.d       |   3 +
 gas/testsuite/gas/riscv/cie-rtn-col-3.d       |  17 ++
 gas/testsuite/gas/riscv/cie-rtn-col.s         |   3 +
 gas/testsuite/gas/riscv/csr-dw-regnums.d      | 265 ++++++++++++++++++++++++++
 gas/testsuite/gas/riscv/csr-dw-regnums.s      | 255 +++++++++++++++++++++++++
 gas/testsuite/gas/riscv/default-cie-version.d |  15 ++
 gas/testsuite/gas/riscv/default-cie-version.s |   2 +
 17 files changed, 815 insertions(+), 75 deletions(-)
 create mode 100644 gas/testsuite/gas/riscv/cie-rtn-col-1.d
 create mode 100644 gas/testsuite/gas/riscv/cie-rtn-col-3.d
 create mode 100644 gas/testsuite/gas/riscv/cie-rtn-col.s
 create mode 100644 gas/testsuite/gas/riscv/csr-dw-regnums.d
 create mode 100644 gas/testsuite/gas/riscv/csr-dw-regnums.s
 create mode 100644 gas/testsuite/gas/riscv/default-cie-version.d
 create mode 100644 gas/testsuite/gas/riscv/default-cie-version.s

-- 
2.14.5



More information about the Binutils mailing list