RISC-V GNU toolchain bumping default ISA spec to 20191213

From: Kito Cheng
Date: Mon Jan 24 2022 - 08:51:04 EST


Hi

It’s Kito Cheng from the RISC-V GCC community, just sharing some news
about the default ISA spec version that has been bumped to 20191213 on
both RISC-V GCC and binutils recently, and that has one major
incompatibility issue between current default ISA spec versions.

The major incompatibility issue is the csr read/write (csrr*/csrw*)
instructions and fence.i instruction has separated from the `I`
extension, become two standalone extensions: Zicsr and Zifencei; so
you might get error messages like that: unrecognized opcode `csrr`.

----------------------------------
# How to resolve those issues?

Here is two solution to resolve:

- First one is what we recommend, adding zicsr and/or zifencei to your
-march option, e.g. -march=rv64imac become
-march=rv64imac_zicsr_zifencei

- The second one is a kind of workaround, using -misa-spec=2.2 to
force RISC-V GCC using the older ISA spec version, however this is
strongly *NOT* recommended.

In case you want everything like before, you can add
--with-isa-spec=2.2 build option for GCC and binutils, then the
toolchain will default using the old version and work as an older GNU
toolchain release.

----------------------------------
# Why GCC/binutils bump that?

The default ISA spec version was set to 2.2 for long time, however the
spec is released at May, 2017, which is 5 years ago, and RISC-V has at
least two ISA spec release after that, so we believe that’s time to
bump, and we also raise the discussion on the RISC-V BoF at Linux
plumber, we reach a consensus is that we should moving forward even
that having incompatible issue.

----------------------------------
# Why bump that so late?

We worried about the incompatibility issue, but we realized that is
unavoidable, and RISC-V is growing very quickly in the past year, so
we believe it would be better to move forward now.


# Why is there an incompatibility issue there? Why can't you avoid that?

That is because the RISC-V ISA spec has changed, we believe the
toolchain should honor what spec written.


----------------------------------
# Which ISA spec versions are supported by GNU toolchain now?

Currently we support 2.2 20190608 and 20191213.

2.2:
https://github.com/riscv/riscv-isa-manual/releases/tag/riscv-user-2.2

20190608:
https://github.com/riscv/riscv-isa-manual/releases/tag/Ratified-IMFDQC-and-Priv-v1.11

20191213:
https://github.com/riscv/riscv-isa-manual/releases/tag/Ratified-IMAFDQC

----------------------------------
# Is there any newer ISA spec supported? It’s 2022!

20191213 is already 2 years ago, but RISC-V didn’t have further formal
ISA spec release after that, what we can promise is that RISC-V GNU
toolchain will support soon if ISA spec has newer release.