]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commit
RISC-V: Add -march=help for gas
authorHau Hsu <hau.hsu@sifive.com>
Fri, 23 Feb 2024 06:17:28 +0000 (14:17 +0800)
committerNelson Chu <nelson@rivosinc.com>
Wed, 13 Mar 2024 05:47:34 +0000 (13:47 +0800)
commit90840a86569c32f63feb549f87507a7b6c84e070
tree1de7eafba1ddddcfae8e1a68d3cd5a016d69d55f
parentef11c1eaffeda578985b2b28f1e64db67bf3b224
RISC-V: Add -march=help for gas

Use -march=help for gas to print all supported extensions and versions.

Here is part of the output of `as -march=help`:
All available -march extensions for RISC-V:
        e                                       1.9
        i                                       2.1, 2.0
        m                                       2.0
        a                                       2.1, 2.0
        f                                       2.2, 2.0
        d                                       2.2, 2.0
        q                                       2.2, 2.0
        c                                       2.0
        v                                       1.0
        h                                       1.0
        zicbom                                  1.0
        zicbop                                  1.0
        ...

This patch assumes that the supported extensions with the same versions
are listed together. For example:
static struct riscv_supported_ext riscv_supported_std_ext[] =
{
  ...
  {"i",         ISA_SPEC_CLASS_20191213,        2, 1, 0 },
  {"i",         ISA_SPEC_CLASS_20190608,        2, 1, 0 },
  {"i",         ISA_SPEC_CLASS_2P2,             2, 0, 0 },
  ...
};

For the "i" extension, 2.1.0 with different spec class are listed together.
This patch records the previous printed extension and version.  If the
current extension and version are the same as the previous one, skip
printing.

bfd/
* elfxx-riscv.c (riscv_print_extensions): New function.  Print
available extensions and versions.
* elfxx-riscv.h (riscv_print_extensions): New declaration.
gas/
* gas/config/tc-riscv.c (md_parse_option): Parse 'help' keyword in
-march option to print available extensions and versions.
* testsuite/gas/riscv/march-help.l: New testcase for -march=help.
* testsuite/gas/riscv/riscv.exp: Updated.
bfd/elfxx-riscv.c
bfd/elfxx-riscv.h
gas/config/tc-riscv.c
gas/testsuite/gas/riscv/march-help.l [new file with mode: 0644]
gas/testsuite/gas/riscv/riscv.exp