From 00d4d1b0a3a4d26c9d741b14e601ed2b86fe39ee Mon Sep 17 00:00:00 2001 From: Nelson Chu Date: Fri, 20 Nov 2020 22:33:11 +0800 Subject: RISC-V: Support to add implicit extensions for G. G is a special case, consider the ISA spec github issue as follows, https://github.com/riscv/riscv-isa-manual/issues/575 My understand is that - i, m, a, f and d extensions are not g's implicit extensions, they are g's expansions. The zifencei is the implicit extension of g, and so is zicsr, since it is implicited by f (or i2p1). However, we add the g with the RISCV_UNKNOWN_VERSION to the subset list, and it will not output to the arch string, it is only used to check what implicit extensions are need to be added. bfd/ * elfxx-riscv.c (riscv_parse_add_subset): Allow to add g with RISCV_UNKNOWN_VERSION versions. (riscv_parse_std_ext): Add g to the subset list, we only use it to add the implicit extensions, but won't output it to arch string. (riscv_parse_add_implicit_subsets): Add implicit zicsr and zifencei for g extension. (riscv_arch_str1): Do not output g to the arch string. * elfxx-riscv.h (RISCV_UNKNOWN_VERSION): Moved to include/opcode/riscv.h. gas/ * testsuite/gas/riscv/attribute-10.d: Updated. * testsuite/gas/riscv/march-imply-g.d: New testcase for g. * testsuite/gas/riscv/march-imply-unsupported.d: The zicsr and zifencei are not supported in the ISA spec v2.2, so don't add and output them. include/ * opcode/riscv.h (RISCV_UNKNOWN_VERSION): added. --- bfd/elfxx-riscv.h | 2 -- 1 file changed, 2 deletions(-) (limited to 'bfd/elfxx-riscv.h') diff --git a/bfd/elfxx-riscv.h b/bfd/elfxx-riscv.h index 89d4abb..4e03ce1 100644 --- a/bfd/elfxx-riscv.h +++ b/bfd/elfxx-riscv.h @@ -33,8 +33,6 @@ riscv_reloc_type_lookup (bfd *, bfd_reloc_code_real_type); extern reloc_howto_type * riscv_elf_rtype_to_howto (bfd *, unsigned int r_type); -#define RISCV_UNKNOWN_VERSION -1 - /* The information of architecture attribute. */ struct riscv_subset_t { -- cgit v1.1