aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKito Cheng <kito.cheng@sifive.com>2020-07-06 19:30:36 -0700
committerNelson Chu <nelson.chu@sifive.com>2020-09-03 11:11:38 +0800
commit72bd6912ea38224481f8bd0ed13b751e0fda4683 (patch)
tree0ba9c3c12bb03120fd7b2608423fb1523c48d533
parentd48b742bc1a7af6a673e747c91bf7c72518a0b6a (diff)
downloadgdb-72bd6912ea38224481f8bd0ed13b751e0fda4683.zip
gdb-72bd6912ea38224481f8bd0ed13b751e0fda4683.tar.gz
gdb-72bd6912ea38224481f8bd0ed13b751e0fda4683.tar.bz2
RISC-V: Improve the error message for the mis-matched ISA versions.
Consider the updated attr-merge-arch-failed-01.d testcase. Extension A's version are mis-matched between attr-merge-arch-failed-01a.s and attr-merge-arch-failed-01b.s. But the old binutils reports that the mis-matched extension is M rather than A. This commit is used to fix the wrong mis-matched error message. Besides, when parsing the arch string in the riscv_parse_subset, it shouldn't be NULL or empty. However, it might be empty when we failed to merge the arch string in the riscv_merge_attributes. Since we should already issue the correct error message in another side, and the message - ISA string must begin with rv32 or rv64 - is meaninglesss when the arch string is empty, so do not issue it. bfd/ * 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. ld/ * 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.
-rw-r--r--bfd/ChangeLog7
-rw-r--r--bfd/elfnn-riscv.c2
-rw-r--r--bfd/elfxx-riscv.c12
-rw-r--r--ld/ChangeLog6
-rw-r--r--ld/testsuite/ld-riscv-elf/attr-merge-arch-failed-01.d2
-rw-r--r--ld/testsuite/ld-riscv-elf/attr-merge-arch-failed-01a.s2
-rw-r--r--ld/testsuite/ld-riscv-elf/attr-merge-arch-failed-01b.s2
7 files changed, 26 insertions, 7 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index 76055ba..8703aeb 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,3 +1,10 @@
+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
diff --git a/bfd/elfnn-riscv.c b/bfd/elfnn-riscv.c
index 8a3338c..f8de719 100644
--- a/bfd/elfnn-riscv.c
+++ b/bfd/elfnn-riscv.c
@@ -2724,7 +2724,7 @@ riscv_merge_std_ext (bfd *ibfd,
&& ((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;
}
diff --git a/bfd/elfxx-riscv.c b/bfd/elfxx-riscv.c
index 1570f1d..cfdd867 100644
--- a/bfd/elfxx-riscv.c
+++ b/bfd/elfxx-riscv.c
@@ -1519,9 +1519,15 @@ riscv_parse_subset (riscv_parse_subset_t *rps,
}
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;
}
diff --git a/ld/ChangeLog b/ld/ChangeLog
index 6c447dd..4bba884 100644
--- a/ld/ChangeLog
+++ b/ld/ChangeLog
@@ -1,3 +1,9 @@
+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):
diff --git a/ld/testsuite/ld-riscv-elf/attr-merge-arch-failed-01.d b/ld/testsuite/ld-riscv-elf/attr-merge-arch-failed-01.d
index c77f80b..8a9c092 100644
--- a/ld/testsuite/ld-riscv-elf/attr-merge-arch-failed-01.d
+++ b/ld/testsuite/ld-riscv-elf/attr-merge-arch-failed-01.d
@@ -2,4 +2,4 @@
#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
diff --git a/ld/testsuite/ld-riscv-elf/attr-merge-arch-failed-01a.s b/ld/testsuite/ld-riscv-elf/attr-merge-arch-failed-01a.s
index acc98a5..365901d 100644
--- a/ld/testsuite/ld-riscv-elf/attr-merge-arch-failed-01a.s
+++ b/ld/testsuite/ld-riscv-elf/attr-merge-arch-failed-01a.s
@@ -1 +1 @@
- .attribute arch, "rv32i2p0_m2p0"
+ .attribute arch, "rv32i2p0_m2p0_a2p0"
diff --git a/ld/testsuite/ld-riscv-elf/attr-merge-arch-failed-01b.s b/ld/testsuite/ld-riscv-elf/attr-merge-arch-failed-01b.s
index c9a590a..49263bf 100644
--- a/ld/testsuite/ld-riscv-elf/attr-merge-arch-failed-01b.s
+++ b/ld/testsuite/ld-riscv-elf/attr-merge-arch-failed-01b.s
@@ -1 +1 @@
- .attribute arch, "rv32i2p0_m3p0"
+ .attribute arch, "rv32i2p0_m2p0_a3p0"