RISC-V: Generalize -march support, add ELF attribute support.
authorKito Cheng <kito.cheng@gmail.com>
Sat, 2 Mar 2019 00:36:22 +0000 (00:36 +0000)
committerJim Wilson <wilson@gcc.gnu.org>
Sat, 2 Mar 2019 00:36:22 +0000 (16:36 -0800)
commit8e96621085f2a0364fe87a4019d6cc9bfc52cd11
treebbe9691899218d19a0877138b5a2ea5b867af3af
parentfe3732876f2b5ec20c7811a42893772045648aa2
RISC-V: Generalize -march support, add ELF attribute support.

Kito Cheng  <kito.cheng@gmail.com>
Monk Chiang  <sh.chiang04@gmail.com>

gcc/
* common/config/riscv/riscv-common.c: Include sstream.
(riscv_subset_list::to_string): New.
(riscv_arch_str): Likewise.
* config.gcc (riscv*-*-*): Handle --with-riscv-attribute=
* config.in: Regen.
* config/riscv/riscv-protos.h (riscv_arch_str): New.
* config/riscv/riscv.c (INCLUDE_STRING): Defined.
(riscv_emit_attribute): New.
(riscv_file_start): Emit attribute if needed.
(riscv_option_override): Init riscv_emit_attribute_p.
* config/riscv/riscv.opt (mriscv-attribute): New option.
* configure.ac (riscv*-*-*): Check binutils is supporting ELF
* configure: Regen.
* doc/install.texi: Document --with-riscv-attribute.
* doc/invoke.texi: Document -mriscv-attribute.

* common/config/riscv/riscv-common.c:
Include config/riscv/riscv-protos.h.
(INCLUDE_STRING): Defined.
(RISCV_DONT_CARE_VERSION): Defined.
(riscv_subset_t): Declare.
(riscv_subset_t::riscv_subset_t): New.
(riscv_subset_list): Declare.
(riscv_subset_list::riscv_subset_list): New.
(riscv_subset_list::~riscv_subset_list): Likewise.
(riscv_subset_list::parsing_subset_version): Likewise.
(riscv_subset_list::parse_std_ext): Likewise.
(riscv_subset_list::parse_sv_or_non_std_ext): Likewise.
(riscv_subset_list::add): Likewise.
(riscv_subset_list::lookup): Likewise.
(riscv_subset_list::xlen): Likewise.
(riscv_subset_list::parse): Likewise.
(riscv_supported_std_ext): Likewise.
(current_subset_list): Likewise.
(riscv_parse_arch_string): Using riscv_subset_list::parse to
parse.

gcc/testsuite/
* gcc.target/riscv/attribute-1.c: New.
* gcc.target/riscv/attribute-2.c: Likewise.
* gcc.target/riscv/attribute-3.c: Likewise.
* gcc.target/riscv/attribute-4.c: Likewise.
* gcc.target/riscv/attribute-5.c: Likewise.
* gcc.target/riscv/attribute-6.c: Likewise.
* gcc.target/riscv/attribute-7.c: Likewise.
* gcc.target/riscv/attribute-8.c: Likewise.
* gcc.target/riscv/attribute-9.c: Likewise.

* gcc.target/riscv/arch-1.c: New.
* gcc.target/riscv/arch-2.c: Likewise.
* gcc.target/riscv/arch-3.c: Likewise.
* gcc.target/riscv/arch-4.c: Likewise.

Co-Authored-By: Monk Chiang <sh.chiang04@gmail.com>
From-SVN: r269337
25 files changed:
gcc/ChangeLog
gcc/common/config/riscv/riscv-common.c
gcc/config.gcc
gcc/config.in
gcc/config/riscv/riscv-protos.h
gcc/config/riscv/riscv.c
gcc/config/riscv/riscv.opt
gcc/configure
gcc/configure.ac
gcc/doc/install.texi
gcc/doc/invoke.texi
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.target/riscv/arch-1.c [new file with mode: 0644]
gcc/testsuite/gcc.target/riscv/arch-2.c [new file with mode: 0644]
gcc/testsuite/gcc.target/riscv/arch-3.c [new file with mode: 0644]
gcc/testsuite/gcc.target/riscv/arch-4.c [new file with mode: 0644]
gcc/testsuite/gcc.target/riscv/attribute-1.c [new file with mode: 0644]
gcc/testsuite/gcc.target/riscv/attribute-2.c [new file with mode: 0644]
gcc/testsuite/gcc.target/riscv/attribute-3.c [new file with mode: 0644]
gcc/testsuite/gcc.target/riscv/attribute-4.c [new file with mode: 0644]
gcc/testsuite/gcc.target/riscv/attribute-5.c [new file with mode: 0644]
gcc/testsuite/gcc.target/riscv/attribute-6.c [new file with mode: 0644]
gcc/testsuite/gcc.target/riscv/attribute-7.c [new file with mode: 0644]
gcc/testsuite/gcc.target/riscv/attribute-8.c [new file with mode: 0644]
gcc/testsuite/gcc.target/riscv/attribute-9.c [new file with mode: 0644]