RISC-V: PR25212, Report errors for invalid march and mabi combinations.
authorNelson Chu <nelson.chu@sifive.com>
Fri, 21 May 2021 07:40:33 +0000 (15:40 +0800)
committerNelson Chu <nelson.chu@sifive.com>
Mon, 24 May 2021 03:47:18 +0000 (11:47 +0800)
commit5d0ed830d362fb8bb200a4f52bf973ba30920802
treea25048d16861f86f54b023437e9df0b41c09ab1e
parentd16ce6e4d581bcd25c7d9a402c19824c59f04276
RISC-V: PR25212, Report errors for invalid march and mabi combinations.

This patch clarify the following invalid combinations of march and mabi,
* ilp32f/lp64f abi without f extension.
* ilp32d/lp64d abi without d extension.
* ilp32q/lp64q abi without q extension.
* e extension with any abi except ilp32e

GNU assembler reports errors when finding the above invalid combinations.
But LLVM-MC reports warnings and ignores these invalid cases.  It help to
set the correct ilp32/lp64/ilp32e abi according to rv32/rv64/rve.  This
looks good and convenient, so perhaps we can do the same things.  However,
if you don't set the mabi, GNU assembler also try to set the suitable
ABI according to march/elf-attribute.  Compared to LLVM-MC, we will choose
double/quad abi if d/f extension is set.

gas/
    PR 25212
    * config/tc-riscv.c (riscv_set_abi_by_arch): If -mabi isn't set, we
    will choose ilp32e abi for rv32e.  Besides, report errors for the
    invalid march and mabi combinations.
    * testsuite/gas/riscv/mabi-attr-rv32e.s: New testcase.  Only accept
    ilp32e abi for rve extension.
    * testsuite/gas/riscv/mabi-fail-rv32e-lp64f.d: Likewise.
    * testsuite/gas/riscv/mabi-fail-rv32e-lp64f.l: Likewise.
    * testsuite/gas/riscv/mabi-fail-rv32e-lp64d.d: Likewise.
    * testsuite/gas/riscv/mabi-fail-rv32e-lp64d.l: Likewise.
    * testsuite/gas/riscv/mabi-fail-rv32e-lp64d.q: Likewise.
    * testsuite/gas/riscv/mabi-fail-rv32e-lp64d.q: Likewise.
    Renamed all mabi testcases to their march-mabi settings.
41 files changed:
gas/ChangeLog
gas/config/tc-riscv.c
gas/testsuite/gas/riscv/mabi-attr-01.s [deleted file]
gas/testsuite/gas/riscv/mabi-attr-02.s [deleted file]
gas/testsuite/gas/riscv/mabi-attr-03.s [deleted file]
gas/testsuite/gas/riscv/mabi-attr-rv32e.s [new file with mode: 0644]
gas/testsuite/gas/riscv/mabi-attr-rv32i.s [new file with mode: 0644]
gas/testsuite/gas/riscv/mabi-attr-rv32id.s [new file with mode: 0644]
gas/testsuite/gas/riscv/mabi-attr-rv64iq.s [new file with mode: 0644]
gas/testsuite/gas/riscv/mabi-fail-01.d [deleted file]
gas/testsuite/gas/riscv/mabi-fail-01.l [deleted file]
gas/testsuite/gas/riscv/mabi-fail-02.d [deleted file]
gas/testsuite/gas/riscv/mabi-fail-02.l [deleted file]
gas/testsuite/gas/riscv/mabi-fail-rv32e-lp64d.d [new file with mode: 0644]
gas/testsuite/gas/riscv/mabi-fail-rv32e-lp64d.l [new file with mode: 0644]
gas/testsuite/gas/riscv/mabi-fail-rv32e-lp64f.d [new file with mode: 0644]
gas/testsuite/gas/riscv/mabi-fail-rv32e-lp64f.l [new file with mode: 0644]
gas/testsuite/gas/riscv/mabi-fail-rv32e-lp64q.d [new file with mode: 0644]
gas/testsuite/gas/riscv/mabi-fail-rv32e-lp64q.l [new file with mode: 0644]
gas/testsuite/gas/riscv/mabi-fail-rv32i-lp64.d [new file with mode: 0644]
gas/testsuite/gas/riscv/mabi-fail-rv32i-lp64.l [new file with mode: 0644]
gas/testsuite/gas/riscv/mabi-fail-rv64iq-ilp32.d [new file with mode: 0644]
gas/testsuite/gas/riscv/mabi-fail-rv64iq-ilp32.l [new file with mode: 0644]
gas/testsuite/gas/riscv/mabi-noabi-attr-01a.d [deleted file]
gas/testsuite/gas/riscv/mabi-noabi-attr-01b.d [deleted file]
gas/testsuite/gas/riscv/mabi-noabi-attr-02a.d [deleted file]
gas/testsuite/gas/riscv/mabi-noabi-attr-02b.d [deleted file]
gas/testsuite/gas/riscv/mabi-noabi-attr-03a.d [deleted file]
gas/testsuite/gas/riscv/mabi-noabi-attr-03b.d [deleted file]
gas/testsuite/gas/riscv/mabi-noabi-attr-rv32i-01.d [new file with mode: 0644]
gas/testsuite/gas/riscv/mabi-noabi-attr-rv32i-02.d [new file with mode: 0644]
gas/testsuite/gas/riscv/mabi-noabi-attr-rv32id-01.d [new file with mode: 0644]
gas/testsuite/gas/riscv/mabi-noabi-attr-rv32id-02.d [new file with mode: 0644]
gas/testsuite/gas/riscv/mabi-noabi-attr-rv64iq-01.d [new file with mode: 0644]
gas/testsuite/gas/riscv/mabi-noabi-attr-rv64iq-02.d [new file with mode: 0644]
gas/testsuite/gas/riscv/mabi-noabi-march-01.d [deleted file]
gas/testsuite/gas/riscv/mabi-noabi-march-02.d [deleted file]
gas/testsuite/gas/riscv/mabi-noabi-march-03.d [deleted file]
gas/testsuite/gas/riscv/mabi-noabi-march-rv32i.d [new file with mode: 0644]
gas/testsuite/gas/riscv/mabi-noabi-march-rv32id.d [new file with mode: 0644]
gas/testsuite/gas/riscv/mabi-noabi-march-rv64iq.d [new file with mode: 0644]