diff options
author | Nelson Chu <nelson.chu@sifive.com> | 2021-04-13 12:32:16 +0800 |
---|---|---|
committer | Nelson Chu <nelson.chu@sifive.com> | 2021-04-13 12:49:51 +0800 |
commit | e3839c100fdb15d05e6a2fd44557ffdd6fb921b8 (patch) | |
tree | 12276e778432ad0ca3459ec5bc2fe3a59d385113 /bfd | |
parent | 8d85d1f53f28f5ec020add7326055f73dce6ced0 (diff) | |
download | gdb-e3839c100fdb15d05e6a2fd44557ffdd6fb921b8.zip gdb-e3839c100fdb15d05e6a2fd44557ffdd6fb921b8.tar.gz gdb-e3839c100fdb15d05e6a2fd44557ffdd6fb921b8.tar.bz2 |
RISC-V: Don't report the mismatched version warning for the implicit extensions.
bfd/
* elfnn-riscv.c (riscv_version_mismatch): Do not report the warning
when the version of input or output is RISCV_UNKNOWN_VERSION, since
the extension is added implicitly.
* elfxx-riscv.c: Updated the obsolete comments.
(RISCV_UNKNOWN_VERSION): Moved to elfxx-riscv.h.
* elfxx-riscv.h (RISCV_UNKNOWN_VERSION): Added.
Diffstat (limited to 'bfd')
-rw-r--r-- | bfd/ChangeLog | 9 | ||||
-rw-r--r-- | bfd/elfnn-riscv.c | 28 | ||||
-rw-r--r-- | bfd/elfxx-riscv.c | 11 | ||||
-rw-r--r-- | bfd/elfxx-riscv.h | 2 |
4 files changed, 33 insertions, 17 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog index fa7e649..28c5791 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,12 @@ +2021-04-13 Nelson Chu <nelson.chu@sifive.com> + + * elfnn-riscv.c (riscv_version_mismatch): Do not report the warning + when the version of input or output is RISCV_UNKNOWN_VERSION, since + the extension is added implicitly. + * elfxx-riscv.c: Updated the obsolete comments. + (RISCV_UNKNOWN_VERSION): Moved to elfxx-riscv.h. + * elfxx-riscv.h (RISCV_UNKNOWN_VERSION): Added. + 2021-04-12 Alan Modra <amodra@gmail.com> * elf-bfd.h (ENABLE_CHECKING): Define. diff --git a/bfd/elfnn-riscv.c b/bfd/elfnn-riscv.c index 07089ef7..5e29278 100644 --- a/bfd/elfnn-riscv.c +++ b/bfd/elfnn-riscv.c @@ -3332,15 +3332,25 @@ riscv_version_mismatch (bfd *ibfd, if (in->major_version != out->major_version || in->minor_version != out->minor_version) { - _bfd_error_handler - (_("warning: %pB: mis-matched ISA version %d.%d for '%s' " - "extension, the output version is %d.%d"), - ibfd, - in->major_version, - in->minor_version, - in->name, - out->major_version, - out->minor_version); + if ((in->major_version == RISCV_UNKNOWN_VERSION + && in->minor_version == RISCV_UNKNOWN_VERSION) + || (out->major_version == RISCV_UNKNOWN_VERSION + && out->minor_version == RISCV_UNKNOWN_VERSION)) + { + /* Do not report the warning when the version of input + or output is RISCV_UNKNOWN_VERSION, since the extension + is added implicitly. */ + } + else + _bfd_error_handler + (_("warning: %pB: mis-matched ISA version %d.%d for '%s' " + "extension, the output version is %d.%d"), + ibfd, + in->major_version, + in->minor_version, + in->name, + out->major_version, + out->minor_version); /* Update the output ISA versions to the newest ones. */ if ((in->major_version > out->major_version) diff --git a/bfd/elfxx-riscv.c b/bfd/elfxx-riscv.c index 13719e5..3b38192 100644 --- a/bfd/elfxx-riscv.c +++ b/bfd/elfxx-riscv.c @@ -1026,8 +1026,6 @@ riscv_elf_add_sub_reloc (bfd *abfd, return bfd_reloc_ok; } -#define RISCV_UNKNOWN_VERSION -1 - /* Lists of prefixed class extensions that binutils should know about. Whether or not a particular entry is in these lists will dictate if gas/ld will accept its presence in the architecture string. @@ -1588,9 +1586,7 @@ riscv_parse_std_ext (riscv_parse_subset_t *rps, Arguments: `rps`: Hooks and status for parsing extensions. `march`: Full ISA string. - `p`: Curent parsing position. - `config`: What class and predicate function to use for the - extension. */ + `p`: Curent parsing position. */ static const char * riscv_parse_prefixed_ext (riscv_parse_subset_t *rps, @@ -1640,9 +1636,8 @@ riscv_parse_prefixed_ext (riscv_parse_subset_t *rps, /* Check if the prefix extension is known. For 'x', anything goes but it cannot simply be 'x'. - For 's', it must be known from a list and cannot simply be 's'. - For 'h', it must be known from a list and cannot simply be 'h'. - For 'z', it must be known from a list and cannot simply be 'z'. */ + For other prefixed extensions, it must be known from a list + and cannot simply be the prefixed name. */ /* Check that the extension name is well-formed. */ if (!riscv_valid_prefixed_ext (subset)) diff --git a/bfd/elfxx-riscv.h b/bfd/elfxx-riscv.h index 2955b75..ff18ff6 100644 --- a/bfd/elfxx-riscv.h +++ b/bfd/elfxx-riscv.h @@ -24,6 +24,8 @@ #include "elf/internal.h" #include "opcode/riscv.h" +#define RISCV_UNKNOWN_VERSION -1 + extern reloc_howto_type * riscv_reloc_name_lookup (bfd *, const char *); |