From cb45bd59481353217ebf18d67c6b013ab2d2f263 Mon Sep 17 00:00:00 2001 From: Nelson Chu Date: Tue, 8 Oct 2024 12:35:43 +0800 Subject: [PATCH] RISC-V: Don't report warnings when linking different privileged spec objects. Since only the abandoned privileged spec v1.9.1 will have conflict csrs, to keep the compatible we still report warnings when linking privileged spec v1.9.1 objects with others. But don't report warnings for other compatible cases because it is actually a bit noisy and useless... bfd/ * elfnn-riscv.c (riscv_merge_attributes): Only report warnings when linking the abandoned privileged spec v1.9.1 object with others. ld/ * testsuite/ld-riscv-elf/attr-merge-priv-spec-failed-01.d: Removed. * testsuite/ld-riscv-elf/attr-merge-priv-spec-failed-02.d: Removed. * testsuite/ld-riscv-elf/attr-merge-priv-spec-failed-03.d: Removed. * testsuite/ld-riscv-elf/attr-merge-priv-spec-failed-04.d: Removed. * testsuite/ld-riscv-elf/attr-merge-priv-spec-failed-05.d: Removed. * testsuite/ld-riscv-elf/attr-merge-priv-spec-failed-06.d: Removed. * testsuite/ld-riscv-elf/ld-riscv-elf.exp: Updated. --- bfd/elfnn-riscv.c | 17 +++-------------- .../attr-merge-priv-spec-failed-01.d | 12 ------------ .../attr-merge-priv-spec-failed-02.d | 12 ------------ .../attr-merge-priv-spec-failed-03.d | 13 ------------- .../attr-merge-priv-spec-failed-04.d | 13 ------------- .../attr-merge-priv-spec-failed-05.d | 13 ------------- .../attr-merge-priv-spec-failed-06.d | 13 ------------- ld/testsuite/ld-riscv-elf/ld-riscv-elf.exp | 6 ------ 8 files changed, 3 insertions(+), 96 deletions(-) delete mode 100644 ld/testsuite/ld-riscv-elf/attr-merge-priv-spec-failed-01.d delete mode 100644 ld/testsuite/ld-riscv-elf/attr-merge-priv-spec-failed-02.d delete mode 100644 ld/testsuite/ld-riscv-elf/attr-merge-priv-spec-failed-03.d delete mode 100644 ld/testsuite/ld-riscv-elf/attr-merge-priv-spec-failed-04.d delete mode 100644 ld/testsuite/ld-riscv-elf/attr-merge-priv-spec-failed-05.d delete mode 100644 ld/testsuite/ld-riscv-elf/attr-merge-priv-spec-failed-06.d diff --git a/bfd/elfnn-riscv.c b/bfd/elfnn-riscv.c index c8bf45f4293..3aba9c85b0f 100644 --- a/bfd/elfnn-riscv.c +++ b/bfd/elfnn-riscv.c @@ -4071,20 +4071,9 @@ riscv_merge_attributes (bfd *ibfd, struct bfd_link_info *info) else if (in_priv_spec != PRIV_SPEC_CLASS_NONE && in_priv_spec != out_priv_spec) { - _bfd_error_handler - (_("warning: %pB use privileged spec version %u.%u.%u but " - "the output use version %u.%u.%u"), - ibfd, - in_attr[Tag_a].i, - in_attr[Tag_b].i, - in_attr[Tag_c].i, - out_attr[Tag_a].i, - out_attr[Tag_b].i, - out_attr[Tag_c].i); - - /* The privileged spec v1.9.1 can not be linked with others - since the conflicts, so we plan to drop it in a year or - two. */ + /* The abandoned privileged spec v1.9.1 can not be linked with + others since the conflicts. Keep the check since compatible + issue. */ if (in_priv_spec == PRIV_SPEC_CLASS_1P9P1 || out_priv_spec == PRIV_SPEC_CLASS_1P9P1) { diff --git a/ld/testsuite/ld-riscv-elf/attr-merge-priv-spec-failed-01.d b/ld/testsuite/ld-riscv-elf/attr-merge-priv-spec-failed-01.d deleted file mode 100644 index 7f987070ea0..00000000000 --- a/ld/testsuite/ld-riscv-elf/attr-merge-priv-spec-failed-01.d +++ /dev/null @@ -1,12 +0,0 @@ -#source: attr-merge-priv-spec-a.s -#source: attr-merge-priv-spec-c.s -#as: -#ld: -r -#warning: .*use privileged spec version 1.11.0 but the output use version 1.10.0 -#readelf: -A - -Attribute Section: riscv -File Attributes - Tag_RISCV_arch: [a-zA-Z0-9_\"].* - Tag_RISCV_priv_spec: 1 - Tag_RISCV_priv_spec_minor: 11 diff --git a/ld/testsuite/ld-riscv-elf/attr-merge-priv-spec-failed-02.d b/ld/testsuite/ld-riscv-elf/attr-merge-priv-spec-failed-02.d deleted file mode 100644 index f86ef10b6bc..00000000000 --- a/ld/testsuite/ld-riscv-elf/attr-merge-priv-spec-failed-02.d +++ /dev/null @@ -1,12 +0,0 @@ -#source: attr-merge-priv-spec-c.s -#source: attr-merge-priv-spec-a.s -#as: -#ld: -r -#warning: .*use privileged spec version 1.10.0 but the output use version 1.11.0 -#readelf: -A - -Attribute Section: riscv -File Attributes - Tag_RISCV_arch: [a-zA-Z0-9_\"].* - Tag_RISCV_priv_spec: 1 - Tag_RISCV_priv_spec_minor: 11 diff --git a/ld/testsuite/ld-riscv-elf/attr-merge-priv-spec-failed-03.d b/ld/testsuite/ld-riscv-elf/attr-merge-priv-spec-failed-03.d deleted file mode 100644 index cfbb23328a6..00000000000 --- a/ld/testsuite/ld-riscv-elf/attr-merge-priv-spec-failed-03.d +++ /dev/null @@ -1,13 +0,0 @@ -#source: attr-merge-priv-spec-a.s -#source: attr-merge-priv-spec-d.s -#source: attr-merge-priv-spec-c.s -#as: -#ld: -r -#warning: .*use privileged spec version 1.11.0 but the output use version 1.10.0 -#readelf: -A - -Attribute Section: riscv -File Attributes - Tag_RISCV_arch: [a-zA-Z0-9_\"].* - Tag_RISCV_priv_spec: 1 - Tag_RISCV_priv_spec_minor: 11 diff --git a/ld/testsuite/ld-riscv-elf/attr-merge-priv-spec-failed-04.d b/ld/testsuite/ld-riscv-elf/attr-merge-priv-spec-failed-04.d deleted file mode 100644 index 4332597daa4..00000000000 --- a/ld/testsuite/ld-riscv-elf/attr-merge-priv-spec-failed-04.d +++ /dev/null @@ -1,13 +0,0 @@ -#source: attr-merge-priv-spec-d.s -#source: attr-merge-priv-spec-a.s -#source: attr-merge-priv-spec-c.s -#as: -#ld: -r -#warning: .*use privileged spec version 1.11.0 but the output use version 1.10.0 -#readelf: -A - -Attribute Section: riscv -File Attributes - Tag_RISCV_arch: [a-zA-Z0-9_\"].* - Tag_RISCV_priv_spec: 1 - Tag_RISCV_priv_spec_minor: 11 diff --git a/ld/testsuite/ld-riscv-elf/attr-merge-priv-spec-failed-05.d b/ld/testsuite/ld-riscv-elf/attr-merge-priv-spec-failed-05.d deleted file mode 100644 index bb6573df51f..00000000000 --- a/ld/testsuite/ld-riscv-elf/attr-merge-priv-spec-failed-05.d +++ /dev/null @@ -1,13 +0,0 @@ -#source: attr-merge-priv-spec-c.s -#source: attr-merge-priv-spec-d.s -#source: attr-merge-priv-spec-a.s -#as: -#ld: -r -#warning: .*use privileged spec version 1.10.0 but the output use version 1.11.0 -#readelf: -A - -Attribute Section: riscv -File Attributes - Tag_RISCV_arch: [a-zA-Z0-9_\"].* - Tag_RISCV_priv_spec: 1 - Tag_RISCV_priv_spec_minor: 11 diff --git a/ld/testsuite/ld-riscv-elf/attr-merge-priv-spec-failed-06.d b/ld/testsuite/ld-riscv-elf/attr-merge-priv-spec-failed-06.d deleted file mode 100644 index 9d97ff99a7b..00000000000 --- a/ld/testsuite/ld-riscv-elf/attr-merge-priv-spec-failed-06.d +++ /dev/null @@ -1,13 +0,0 @@ -#source: attr-merge-priv-spec-d.s -#source: attr-merge-priv-spec-c.s -#source: attr-merge-priv-spec-a.s -#as: -#ld: -r -#warning: .*use privileged spec version 1.10.0 but the output use version 1.11.0 -#readelf: -A - -Attribute Section: riscv -File Attributes - Tag_RISCV_arch: [a-zA-Z0-9_\"].* - Tag_RISCV_priv_spec: 1 - Tag_RISCV_priv_spec_minor: 11 diff --git a/ld/testsuite/ld-riscv-elf/ld-riscv-elf.exp b/ld/testsuite/ld-riscv-elf/ld-riscv-elf.exp index 0ee20255551..7b1b2aa285d 100644 --- a/ld/testsuite/ld-riscv-elf/ld-riscv-elf.exp +++ b/ld/testsuite/ld-riscv-elf/ld-riscv-elf.exp @@ -165,12 +165,6 @@ if [istarget "riscv*-*-*"] { run_dump_test "attr-merge-priv-spec-03" run_dump_test "attr-merge-user-ext-01" 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" - run_dump_test "attr-merge-priv-spec-failed-03" - run_dump_test "attr-merge-priv-spec-failed-04" - run_dump_test "attr-merge-priv-spec-failed-05" - run_dump_test "attr-merge-priv-spec-failed-06" run_dump_test "attr-phdr" run_dump_test "relax-max-align-gp" run_dump_test "uleb128"