RISC-V: Don't report the mismatched version warning for the implicit extensions.
authorNelson Chu <nelson.chu@sifive.com>
Tue, 13 Apr 2021 04:32:16 +0000 (12:32 +0800)
committerNelson Chu <nelson.chu@sifive.com>
Tue, 13 Apr 2021 04:49:51 +0000 (12:49 +0800)
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.

bfd/ChangeLog
bfd/elfnn-riscv.c
bfd/elfxx-riscv.c
bfd/elfxx-riscv.h

index fa7e649c022c2c123885b7b85dcebefaa8f04c3f..28c5791282c5cf5821555bca4f8f5748bef608c6 100644 (file)
@@ -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.
index 07089ef7b7ebd6b894b81f1b58c004fcf537a809..5e292785e9fc7a6bf11a23f301a79a1c095531b3 100644 (file)
@@ -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)
index 13719e508b9a4021b8630646bad48803e551312d..3b381925758c1e46b4db7798022a8715a12d05c5 100644 (file)
@@ -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))
index 2955b753fcaa628704ee157003b979838b059053..ff18ff6f0b86d46fcb2c044c86d7adb0634155f9 100644 (file)
@@ -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 *);
 
This page took 0.035279 seconds and 4 git commands to generate.