+2020-09-03  Kito Cheng  <kito.cheng@sifive.com>
+
+       * elfnn-riscv.c (riscv_merge_std_ext): Fix to report the correct
+       error message when the versions of extension are mis-matched.
+       * elfxx-riscv.c (riscv_parse_subset): Don't issue the error when
+       the string is empty.
+
 2020-09-03  Alan Modra  <amodra@gmail.com>
 
        * xcofflink.c (xcoff_get_archive_info): Allocate xcoff_archive_info
 
          && ((find_in->major_version != find_out->major_version)
              || (find_in->minor_version != find_out->minor_version)))
        {
-         riscv_version_mismatch (ibfd, in, out);
+         riscv_version_mismatch (ibfd, find_in, find_out);
          return FALSE;
        }
 
 
     }
   else
     {
-      rps->error_handler
-       (_("-march=%s: ISA string must begin with rv32 or rv64"),
-        arch);
+      /* Arch string shouldn't be NULL or empty here.  However,
+        it might be empty only when we failed to merge the arch
+        string in the riscv_merge_attributes.  We have already
+        issued the correct error message in another side, so do
+        not issue this error when the arch string is empty.  */
+      if (strlen (arch))
+       rps->error_handler (
+         _("-march=%s: ISA string must begin with rv32 or rv64"),
+         arch);
       return FALSE;
     }
 
 
+2020-09-03  Kito Cheng  <kito.cheng@sifive.com>
+
+       * testsuite/ld-riscv-elf/attr-merge-arch-failed-01.d: Updated.
+       * testsuite/ld-riscv-elf/attr-merge-arch-failed-01a.s: Likewise.
+       * testsuite/ld-riscv-elf/attr-merge-arch-failed-01b.s: Likewise.
+
 2020-09-03  Alan Modra  <amodra@gmail.com>
 
        * testsuite/ld-scripts/sysroot-prefix.exp (single_sysroot_prefix_test):
 
 #source: attr-merge-arch-failed-01b.s
 #as: -march-attr
 #ld: -r -melf32lriscv
-#error: Mis-matched ISA version for 'm' extension. 3.0 vs 2.0
+#error: Mis-matched ISA version for 'a' extension. 3.0 vs 2.0
 
-       .attribute arch, "rv32i2p0_m2p0"
+       .attribute arch, "rv32i2p0_m2p0_a2p0"
 
-       .attribute arch, "rv32i2p0_m3p0"
+       .attribute arch, "rv32i2p0_m2p0_a3p0"