From: Nelson Chu <nelson.chu@sifive.com>
To: binutils@sourceware.org, jim.wilson.gcc@gmail.com,
kito.cheng@sifive.com, palmer@dabbelt.com, andrew@sifive.com
Subject: [PATCH 1/2] RISC-V: Don't report mismatch warnings when versions are larger than 1.0.
Date: Thu, 30 Dec 2021 08:00:27 -0800 [thread overview]
Message-ID: <1640880028-16820-1-git-send-email-nelson.chu@sifive.com> (raw)
In general, the extension is ratified when it's version is 1.0, that means
the versions larger than 1.0 should be compatible. Therefore, report the
mismatch warnings for these compatible versions seems redundant and a little
bit annoying. I know that there are some exceptions like zba 0.93 and e 1.9,
but we could handle them specially in the future patches.
bfd/
* elfnn-riscv.c (riscv_version_mismatch): Do not report the mismatch
warnings when versions are larger than 1.0.
ld/
* testsuite/ld-riscv-elf/attr-merge-arch-failed-01.d: Removed.
* testsuite/ld-riscv-elf/attr-merge-arch-failed-01a.s: Removed.
* testsuite/ld-riscv-elf/attr-merge-arch-failed-01b.s: Removed.
* testsuite/ld-riscv-elf/attr-merge-arch-failed-ratified.d: Updated
and renamed from attr-merge-arch-failed-02a testcase.
* testsuite/ld-riscv-elf/attr-merge-arch-failed-ratified-a.s: Likewise.
* testsuite/ld-riscv-elf/attr-merge-arch-failed-ratified-b.s: Likewise.
* testsuite/ld-riscv-elf/attr-merge-arch-failed-ratified-c.s: Likewise.
* testsuite/ld-riscv-elf/attr-merge-arch-failed-ratified-d.s: Likewise.
* testsuite/ld-riscv-elf/ld-riscv-elf.exp: Updated.
---
bfd/elfnn-riscv.c | 12 ++++++----
.../ld-riscv-elf/attr-merge-arch-failed-01.d | 11 ---------
.../ld-riscv-elf/attr-merge-arch-failed-01a.s | 1 -
.../ld-riscv-elf/attr-merge-arch-failed-01b.s | 1 -
.../ld-riscv-elf/attr-merge-arch-failed-02.d | 27 ----------------------
.../ld-riscv-elf/attr-merge-arch-failed-02a.s | 1 -
.../ld-riscv-elf/attr-merge-arch-failed-02b.s | 1 -
.../ld-riscv-elf/attr-merge-arch-failed-02c.s | 1 -
.../ld-riscv-elf/attr-merge-arch-failed-02d.s | 1 -
.../attr-merge-arch-failed-ratified-a.s | 1 +
.../attr-merge-arch-failed-ratified-b.s | 1 +
.../attr-merge-arch-failed-ratified-c.s | 1 +
.../attr-merge-arch-failed-ratified-d.s | 1 +
.../ld-riscv-elf/attr-merge-arch-failed-ratified.d | 22 ++++++++++++++++++
ld/testsuite/ld-riscv-elf/ld-riscv-elf.exp | 3 +--
15 files changed, 35 insertions(+), 50 deletions(-)
delete mode 100644 ld/testsuite/ld-riscv-elf/attr-merge-arch-failed-01.d
delete mode 100644 ld/testsuite/ld-riscv-elf/attr-merge-arch-failed-01a.s
delete mode 100644 ld/testsuite/ld-riscv-elf/attr-merge-arch-failed-01b.s
delete mode 100644 ld/testsuite/ld-riscv-elf/attr-merge-arch-failed-02.d
delete mode 100644 ld/testsuite/ld-riscv-elf/attr-merge-arch-failed-02a.s
delete mode 100644 ld/testsuite/ld-riscv-elf/attr-merge-arch-failed-02b.s
delete mode 100644 ld/testsuite/ld-riscv-elf/attr-merge-arch-failed-02c.s
delete mode 100644 ld/testsuite/ld-riscv-elf/attr-merge-arch-failed-02d.s
create mode 100644 ld/testsuite/ld-riscv-elf/attr-merge-arch-failed-ratified-a.s
create mode 100644 ld/testsuite/ld-riscv-elf/attr-merge-arch-failed-ratified-b.s
create mode 100644 ld/testsuite/ld-riscv-elf/attr-merge-arch-failed-ratified-c.s
create mode 100644 ld/testsuite/ld-riscv-elf/attr-merge-arch-failed-ratified-d.s
create mode 100644 ld/testsuite/ld-riscv-elf/attr-merge-arch-failed-ratified.d
diff --git a/bfd/elfnn-riscv.c b/bfd/elfnn-riscv.c
index d8c9066..ba2f2c1 100644
--- a/bfd/elfnn-riscv.c
+++ b/bfd/elfnn-riscv.c
@@ -3389,11 +3389,15 @@ riscv_version_mismatch (bfd *ibfd,
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))
+ && out->minor_version == RISCV_UNKNOWN_VERSION)
+ || (in->major_version > 0
+ && out->major_version > 0))
{
- /* Do not report the warning when the version of input
- or output is RISCV_UNKNOWN_VERSION, since the extension
- is added implicitly. */
+ /* Do not report the warning when,
+ * The version of input or output is RISCV_UNKNOWN_VERSION,
+ since the extension is added implicitly.
+ * The version of input and output are larger than v1.0,
+ which means they are ratified in general. */
}
else
_bfd_error_handler
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
deleted file mode 100644
index 669a139..0000000
--- a/ld/testsuite/ld-riscv-elf/attr-merge-arch-failed-01.d
+++ /dev/null
@@ -1,11 +0,0 @@
-#source: attr-merge-arch-failed-01a.s
-#source: attr-merge-arch-failed-01b.s
-#as: -march-attr
-#ld: -r -m[riscv_choose_ilp32_emul]
-#warning: .*mis-matched ISA version 3.0 for 'a' extension, the output version is 2.0
-#readelf: -A
-
-Attribute Section: riscv
-File Attributes
- Tag_RISCV_arch: ".*a3p0.*"
-#..
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
deleted file mode 100644
index 365901d..0000000
--- a/ld/testsuite/ld-riscv-elf/attr-merge-arch-failed-01a.s
+++ /dev/null
@@ -1 +0,0 @@
- .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
deleted file mode 100644
index 49263bf..0000000
--- a/ld/testsuite/ld-riscv-elf/attr-merge-arch-failed-01b.s
+++ /dev/null
@@ -1 +0,0 @@
- .attribute arch, "rv32i2p0_m2p0_a3p0"
diff --git a/ld/testsuite/ld-riscv-elf/attr-merge-arch-failed-02.d b/ld/testsuite/ld-riscv-elf/attr-merge-arch-failed-02.d
deleted file mode 100644
index 3f4935d..0000000
--- a/ld/testsuite/ld-riscv-elf/attr-merge-arch-failed-02.d
+++ /dev/null
@@ -1,27 +0,0 @@
-#source: attr-merge-arch-failed-02a.s
-#source: attr-merge-arch-failed-02b.s
-#source: attr-merge-arch-failed-02c.s
-#source: attr-merge-arch-failed-02d.s
-#as: -march-attr
-#ld: -r -m[riscv_choose_ilp32_emul]
-#warning: .*mis-matched ISA version 3.0 for 'i' extension, the output version is 2.0
-#warning: .*mis-matched ISA version 3.0 for 'm' extension, the output version is 2.0
-#warning: .*mis-matched ISA version 3.0 for 'a' extension, the output version is 2.0
-#warning: .*mis-matched ISA version 3.0 for 'zicsr' extension, the output version is 2.0
-#warning: .*mis-matched ISA version 3.0 for 'xunknown' extension, the output version is 2.0
-#warning: .*mis-matched ISA version 2.1 for 'i' extension, the output version is 3.0
-#warning: .*mis-matched ISA version 2.2 for 'm' extension, the output version is 3.0
-#warning: .*mis-matched ISA version 2.3 for 'a' extension, the output version is 3.0
-#warning: .*mis-matched ISA version 2.4 for 'zicsr' extension, the output version is 3.0
-#warning: .*mis-matched ISA version 2.5 for 'xunknown' extension, the output version is 3.0
-#warning: .*mis-matched ISA version 4.6 for 'i' extension, the output version is 3.0
-#warning: .*mis-matched ISA version 4.7 for 'm' extension, the output version is 3.0
-#warning: .*mis-matched ISA version 4.8 for 'a' extension, the output version is 3.0
-#warning: .*mis-matched ISA version 4.9 for 'zicsr' extension, the output version is 3.0
-#warning: .*mis-matched ISA version 4.0 for 'xunknown' extension, the output version is 3.0
-#readelf: -A
-
-Attribute Section: riscv
-File Attributes
- Tag_RISCV_arch: "rv32i4p6_m4p7_a4p8_zicsr4p9_xunknown4p0"
-#..
diff --git a/ld/testsuite/ld-riscv-elf/attr-merge-arch-failed-02a.s b/ld/testsuite/ld-riscv-elf/attr-merge-arch-failed-02a.s
deleted file mode 100644
index 3dbf8a2..0000000
--- a/ld/testsuite/ld-riscv-elf/attr-merge-arch-failed-02a.s
+++ /dev/null
@@ -1 +0,0 @@
- .attribute arch, "rv32i2p0_m2p0_a2p0_zicsr2p0_xunknown2p0"
diff --git a/ld/testsuite/ld-riscv-elf/attr-merge-arch-failed-02b.s b/ld/testsuite/ld-riscv-elf/attr-merge-arch-failed-02b.s
deleted file mode 100644
index 7bbc39f..0000000
--- a/ld/testsuite/ld-riscv-elf/attr-merge-arch-failed-02b.s
+++ /dev/null
@@ -1 +0,0 @@
- .attribute arch, "rv32i3p0_m3p0_a3p0_zicsr3p0_xunknown3p0"
diff --git a/ld/testsuite/ld-riscv-elf/attr-merge-arch-failed-02c.s b/ld/testsuite/ld-riscv-elf/attr-merge-arch-failed-02c.s
deleted file mode 100644
index 2a921e6..0000000
--- a/ld/testsuite/ld-riscv-elf/attr-merge-arch-failed-02c.s
+++ /dev/null
@@ -1 +0,0 @@
- .attribute arch, "rv32i2p1_m2p2_a2p3_zicsr2p4_xunknown2p5"
diff --git a/ld/testsuite/ld-riscv-elf/attr-merge-arch-failed-02d.s b/ld/testsuite/ld-riscv-elf/attr-merge-arch-failed-02d.s
deleted file mode 100644
index 6ef5ee5..0000000
--- a/ld/testsuite/ld-riscv-elf/attr-merge-arch-failed-02d.s
+++ /dev/null
@@ -1 +0,0 @@
- .attribute arch, "rv32i4p6_m4p7_a4p8_zicsr4p9_xunknown4p0"
diff --git a/ld/testsuite/ld-riscv-elf/attr-merge-arch-failed-ratified-a.s b/ld/testsuite/ld-riscv-elf/attr-merge-arch-failed-ratified-a.s
new file mode 100644
index 0000000..e7fadf0
--- /dev/null
+++ b/ld/testsuite/ld-riscv-elf/attr-merge-arch-failed-ratified-a.s
@@ -0,0 +1 @@
+ .attribute arch, "rv32i0p1_m0p1_a0p1_zicsr0p1_xunknown0p1"
diff --git a/ld/testsuite/ld-riscv-elf/attr-merge-arch-failed-ratified-b.s b/ld/testsuite/ld-riscv-elf/attr-merge-arch-failed-ratified-b.s
new file mode 100644
index 0000000..1a7a11c
--- /dev/null
+++ b/ld/testsuite/ld-riscv-elf/attr-merge-arch-failed-ratified-b.s
@@ -0,0 +1 @@
+ .attribute arch, "rv32i0p9_m0p9_a0p9_zicsr0p9_xunknown0p9"
diff --git a/ld/testsuite/ld-riscv-elf/attr-merge-arch-failed-ratified-c.s b/ld/testsuite/ld-riscv-elf/attr-merge-arch-failed-ratified-c.s
new file mode 100644
index 0000000..1a935e7
--- /dev/null
+++ b/ld/testsuite/ld-riscv-elf/attr-merge-arch-failed-ratified-c.s
@@ -0,0 +1 @@
+ .attribute arch, "rv32i1p0_m1p0_a1p0_zicsr1p0_xunknown1p0"
diff --git a/ld/testsuite/ld-riscv-elf/attr-merge-arch-failed-ratified-d.s b/ld/testsuite/ld-riscv-elf/attr-merge-arch-failed-ratified-d.s
new file mode 100644
index 0000000..3dbf8a2
--- /dev/null
+++ b/ld/testsuite/ld-riscv-elf/attr-merge-arch-failed-ratified-d.s
@@ -0,0 +1 @@
+ .attribute arch, "rv32i2p0_m2p0_a2p0_zicsr2p0_xunknown2p0"
diff --git a/ld/testsuite/ld-riscv-elf/attr-merge-arch-failed-ratified.d b/ld/testsuite/ld-riscv-elf/attr-merge-arch-failed-ratified.d
new file mode 100644
index 0000000..b835aa3
--- /dev/null
+++ b/ld/testsuite/ld-riscv-elf/attr-merge-arch-failed-ratified.d
@@ -0,0 +1,22 @@
+#source: attr-merge-arch-failed-ratified-a.s
+#source: attr-merge-arch-failed-ratified-b.s
+#source: attr-merge-arch-failed-ratified-c.s
+#source: attr-merge-arch-failed-ratified-d.s
+#as: -march-attr
+#ld: -r -m[riscv_choose_ilp32_emul]
+#warning: .*mis-matched ISA version 0.9 for 'i' extension, the output version is 0.1
+#warning: .*mis-matched ISA version 0.9 for 'm' extension, the output version is 0.1
+#warning: .*mis-matched ISA version 0.9 for 'a' extension, the output version is 0.1
+#warning: .*mis-matched ISA version 0.9 for 'zicsr' extension, the output version is 0.1
+#warning: .*mis-matched ISA version 0.9 for 'xunknown' extension, the output version is 0.1
+#warning: .*mis-matched ISA version 1.0 for 'i' extension, the output version is 0.9
+#warning: .*mis-matched ISA version 1.0 for 'm' extension, the output version is 0.9
+#warning: .*mis-matched ISA version 1.0 for 'a' extension, the output version is 0.9
+#warning: .*mis-matched ISA version 1.0 for 'zicsr' extension, the output version is 0.9
+#warning: .*mis-matched ISA version 1.0 for 'xunknown' extension, the output version is 0.9
+#readelf: -A
+
+Attribute Section: riscv
+File Attributes
+ Tag_RISCV_arch: "rv32i2p0_m2p0_a2p0_zicsr2p0_xunknown2p0"
+#..
diff --git a/ld/testsuite/ld-riscv-elf/ld-riscv-elf.exp b/ld/testsuite/ld-riscv-elf/ld-riscv-elf.exp
index 961f064..84d3654 100644
--- a/ld/testsuite/ld-riscv-elf/ld-riscv-elf.exp
+++ b/ld/testsuite/ld-riscv-elf/ld-riscv-elf.exp
@@ -160,8 +160,7 @@ if [istarget "riscv*-*-*"] {
run_dump_test "attr-merge-priv-spec-01"
run_dump_test "attr-merge-priv-spec-02"
run_dump_test "attr-merge-priv-spec-03"
- run_dump_test "attr-merge-arch-failed-01"
- run_dump_test "attr-merge-arch-failed-02"
+ run_dump_test "attr-merge-arch-failed-ratified"
run_dump_test "attr-merge-stack-align-failed"
run_dump_test "attr-merge-priv-spec-failed-01"
run_dump_test "attr-merge-priv-spec-failed-02"
--
2.7.4
next reply other threads:[~2021-12-30 16:00 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-12-30 16:00 Nelson Chu [this message]
2021-12-30 16:00 ` [PATCH 2/2] RISC-V: Updated the default ISA spec to 20191213 Nelson Chu
2021-12-30 16:46 ` Palmer Dabbelt
2022-01-07 11:02 ` Nelson Chu
2022-02-06 12:26 ` [PATCH 1/2] RISC-V: Don't report mismatch warnings when versions are larger than 1.0 Aurelien Jarno
2022-02-07 21:09 ` Palmer Dabbelt
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1640880028-16820-1-git-send-email-nelson.chu@sifive.com \
--to=nelson.chu@sifive.com \
--cc=andrew@sifive.com \
--cc=binutils@sourceware.org \
--cc=jim.wilson.gcc@gmail.com \
--cc=kito.cheng@sifive.com \
--cc=palmer@dabbelt.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).