+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.
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)
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.
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,
/* 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))
#include "elf/internal.h"
#include "opcode/riscv.h"
+#define RISCV_UNKNOWN_VERSION -1
+
extern reloc_howto_type *
riscv_reloc_name_lookup (bfd *, const char *);