RISC-V: Clarify the behavior of .option arch directive.
authorNelson Chu <nelson.chu@sifive.com>
Thu, 9 Dec 2021 03:52:16 +0000 (11:52 +0800)
committerNelson Chu <nelson.chu@sifive.com>
Thu, 9 Dec 2021 07:55:04 +0000 (15:55 +0800)
commitde3a913df6e0af6d6d88ecd308407971a44eae9e
tree14e77968337e32f78b93c63059b89c461037b5aa
parentde8a2781a57ecb4a852fb5b734bc7ce71bad34c9
RISC-V: Clarify the behavior of .option arch directive.

* To be consistent with -march option, removed the "=" operator when
user want to reset the whole architecture string.  So the formats are,

.option arch, +<extension><version>, ...
.option arch, -<extension>
.option arch, <ISA string>

* Don't allow to add or remove the base extensions in the .option arch
directive.  Instead, users should reset the whole architecture string
while they want to change the base extension.

* The operator "+" won't update the version of extension, if the
extension is already in the subset list.

bfd/
* elfxx-riscv.c (riscv_add_subset): Don't update the version
if the extension is already in the subset list.
(riscv_update_subset): To be consistent with -march option,
removed the "=" operator when user want to reset the whole
architecture string.  Besides, Don't allow to add or remove
the base extensions in the .option arch directive.
gas/
* testsuite/gas/riscv/option-arch-01.s: Updated since we cannot
add or remove the base extensions in the .option arch directive.
* testsuite/gas/riscv/option-arch-02.s: Likewise.
* testsuite/gas/riscv/option-arch-fail.l: Likewise.
* testsuite/gas/riscv/option-arch-fail.s: Likewise.
* testsuite/gas/riscv/option-arch-01a.d: Set -misa-spec=2.2.
* testsuite/gas/riscv/option-arch-01b.d: Likewise.
* testsuite/gas/riscv/option-arch-02.d: Updated since the .option
arch, + won't change the version of extension, if the extension is
already in the subset list.
* testsuite/gas/riscv/option-arch-03.s: Removed the "=" operator
when resetting the whole architecture string.
bfd/elfxx-riscv.c
gas/testsuite/gas/riscv/option-arch-01.s
gas/testsuite/gas/riscv/option-arch-01a.d
gas/testsuite/gas/riscv/option-arch-01b.d
gas/testsuite/gas/riscv/option-arch-02.d
gas/testsuite/gas/riscv/option-arch-02.s
gas/testsuite/gas/riscv/option-arch-03.s
gas/testsuite/gas/riscv/option-arch-fail.l
gas/testsuite/gas/riscv/option-arch-fail.s