aboutsummaryrefslogtreecommitdiff
path: root/ld
diff options
context:
space:
mode:
authorNelson Chu <nelson.chu@sifive.com>2020-05-29 16:56:36 +0800
committerNelson Chu <nelson.chu@sifive.com>2020-06-05 12:20:53 +0800
commit412857647fecd41c45fab0d9c45198a0d2cbf6d5 (patch)
tree6d7dac8aa992b1ece6b59ad0be9a95929f73d41f /ld
parent3fc6c3dc2af2283bd89f1b1278b39922416e8d1b (diff)
downloadbinutils-412857647fecd41c45fab0d9c45198a0d2cbf6d5.zip
binutils-412857647fecd41c45fab0d9c45198a0d2cbf6d5.tar.gz
binutils-412857647fecd41c45fab0d9c45198a0d2cbf6d5.tar.bz2
RISC-V: The object without priv spec attributes can be linked with any object.
bfd/ * elfnn-riscv.c (riscv_merge_attributes): Add new boolean priv_may_conflict, in_priv_zero and out_priv_zero to decide whether the object can be linked according to it's priv attributes. The object without any priv spec attributes can be linked with others. If the first input object doesn't contain any priv attributes, then we need to copy the setting from the next input one. Also report more detailed error messages to user. ld/ * testsuite/ld-riscv-elf/attr-merge-priv-spec.d: Rename to attr-merge-priv-spec-01.d. * testsuite/ld-riscv-elf/attr-merge-priv-spec-c.s: Set priv spec to 1.11. * testsuite/ld-riscv-elf/attr-merge-priv-spec-d.s: Empty priv spec setting. * testsuite/ld-riscv-elf/attr-merge-priv-spec-02.d: New testcase. * testsuite/ld-riscv-elf/attr-merge-priv-spec-03.d: Likewise. * testsuite/ld-riscv-elf/attr-merge-priv-spec-failed-01.d: Likewise. * testsuite/ld-riscv-elf/attr-merge-priv-spec-failed-02.d: Likewise. * testsuite/ld-riscv-elf/attr-merge-priv-spec-failed-03.d: Likewise. * testsuite/ld-riscv-elf/attr-merge-priv-spec-failed-04.d: Likewise. * testsuite/ld-riscv-elf/attr-merge-priv-spec-failed-05.d: Likewise. * testsuite/ld-riscv-elf/attr-merge-priv-spec-failed-06.d: Likewise. * testsuite/ld-riscv-elf/ld-riscv-elf.exp: Updated.
Diffstat (limited to 'ld')
-rw-r--r--ld/ChangeLog15
-rw-r--r--ld/testsuite/ld-riscv-elf/attr-merge-priv-spec-01.d (renamed from ld/testsuite/ld-riscv-elf/attr-merge-priv-spec.d)0
-rw-r--r--ld/testsuite/ld-riscv-elf/attr-merge-priv-spec-02.d12
-rw-r--r--ld/testsuite/ld-riscv-elf/attr-merge-priv-spec-03.d12
-rw-r--r--ld/testsuite/ld-riscv-elf/attr-merge-priv-spec-c.s2
-rw-r--r--ld/testsuite/ld-riscv-elf/attr-merge-priv-spec-d.s1
-rw-r--r--ld/testsuite/ld-riscv-elf/attr-merge-priv-spec-failed-01.d5
-rw-r--r--ld/testsuite/ld-riscv-elf/attr-merge-priv-spec-failed-02.d5
-rw-r--r--ld/testsuite/ld-riscv-elf/attr-merge-priv-spec-failed-03.d6
-rw-r--r--ld/testsuite/ld-riscv-elf/attr-merge-priv-spec-failed-04.d6
-rw-r--r--ld/testsuite/ld-riscv-elf/attr-merge-priv-spec-failed-05.d6
-rw-r--r--ld/testsuite/ld-riscv-elf/attr-merge-priv-spec-failed-06.d6
-rw-r--r--ld/testsuite/ld-riscv-elf/ld-riscv-elf.exp10
13 files changed, 85 insertions, 1 deletions
diff --git a/ld/ChangeLog b/ld/ChangeLog
index 5b6805a..b40d36b 100644
--- a/ld/ChangeLog
+++ b/ld/ChangeLog
@@ -1,5 +1,20 @@
2020-06-05 Nelson Chu <nelson.chu@sifive.com>
+ * testsuite/ld-riscv-elf/attr-merge-priv-spec.d: Rename to
+ attr-merge-priv-spec-01.d.
+ * testsuite/ld-riscv-elf/attr-merge-priv-spec-c.s: Set spec to 1.11.
+ * testsuite/ld-riscv-elf/attr-merge-priv-spec-d.s: Empty priv spec set.
+ * testsuite/ld-riscv-elf/attr-merge-priv-spec-02.d: New testcase.
+ * testsuite/ld-riscv-elf/attr-merge-priv-spec-03.d: Likewise.
+ * testsuite/ld-riscv-elf/attr-merge-priv-spec-failed-02.d: Likewise.
+ * testsuite/ld-riscv-elf/attr-merge-priv-spec-failed-03.d: Likewise.
+ * testsuite/ld-riscv-elf/attr-merge-priv-spec-failed-04.d: Likewise.
+ * testsuite/ld-riscv-elf/attr-merge-priv-spec-failed-05.d: Likewise.
+ * testsuite/ld-riscv-elf/attr-merge-priv-spec-failed-06.d: Likewise.
+ * testsuite/ld-riscv-elf/ld-riscv-elf.exp: Updated.
+
+2020-06-05 Nelson Chu <nelson.chu@sifive.com>
+
* testsuite/ld-riscv-elf/attr-merge-arch-01.d: The CSR isn't used,
so ignore the -mpriv-spec setting.
* testsuite/ld-riscv-elf/attr-merge-arch-02.d: Likewise.
diff --git a/ld/testsuite/ld-riscv-elf/attr-merge-priv-spec.d b/ld/testsuite/ld-riscv-elf/attr-merge-priv-spec-01.d
index 0aa6fe0..0aa6fe0 100644
--- a/ld/testsuite/ld-riscv-elf/attr-merge-priv-spec.d
+++ b/ld/testsuite/ld-riscv-elf/attr-merge-priv-spec-01.d
diff --git a/ld/testsuite/ld-riscv-elf/attr-merge-priv-spec-02.d b/ld/testsuite/ld-riscv-elf/attr-merge-priv-spec-02.d
new file mode 100644
index 0000000..0ac4ca7
--- /dev/null
+++ b/ld/testsuite/ld-riscv-elf/attr-merge-priv-spec-02.d
@@ -0,0 +1,12 @@
+#source: attr-merge-priv-spec-a.s
+#source: attr-merge-priv-spec-d.s
+#as: -march-attr
+#ld: -r
+#readelf: -A
+
+Attribute Section: riscv
+File Attributes
+ Tag_RISCV_arch: [a-zA-Z0-9_\"].*
+ Tag_RISCV_priv_spec: 1
+ Tag_RISCV_priv_spec_minor: 9
+ Tag_RISCV_priv_spec_revision: 1
diff --git a/ld/testsuite/ld-riscv-elf/attr-merge-priv-spec-03.d b/ld/testsuite/ld-riscv-elf/attr-merge-priv-spec-03.d
new file mode 100644
index 0000000..6950483
--- /dev/null
+++ b/ld/testsuite/ld-riscv-elf/attr-merge-priv-spec-03.d
@@ -0,0 +1,12 @@
+#source: attr-merge-priv-spec-d.s
+#source: attr-merge-priv-spec-a.s
+#as: -march-attr
+#ld: -r
+#readelf: -A
+
+Attribute Section: riscv
+File Attributes
+ Tag_RISCV_arch: [a-zA-Z0-9_\"].*
+ Tag_RISCV_priv_spec: 1
+ Tag_RISCV_priv_spec_minor: 9
+ Tag_RISCV_priv_spec_revision: 1
diff --git a/ld/testsuite/ld-riscv-elf/attr-merge-priv-spec-c.s b/ld/testsuite/ld-riscv-elf/attr-merge-priv-spec-c.s
new file mode 100644
index 0000000..7ea3185
--- /dev/null
+++ b/ld/testsuite/ld-riscv-elf/attr-merge-priv-spec-c.s
@@ -0,0 +1,2 @@
+ .attribute priv_spec, 1
+ .attribute priv_spec_minor, 11
diff --git a/ld/testsuite/ld-riscv-elf/attr-merge-priv-spec-d.s b/ld/testsuite/ld-riscv-elf/attr-merge-priv-spec-d.s
new file mode 100644
index 0000000..37fddd0
--- /dev/null
+++ b/ld/testsuite/ld-riscv-elf/attr-merge-priv-spec-d.s
@@ -0,0 +1 @@
+# Empty priv attributes setting.
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
new file mode 100644
index 0000000..c52ebac
--- /dev/null
+++ b/ld/testsuite/ld-riscv-elf/attr-merge-priv-spec-failed-01.d
@@ -0,0 +1,5 @@
+#source: attr-merge-priv-spec-a.s
+#source: attr-merge-priv-spec-c.s
+#as:
+#ld: -r
+#error: .*use privilege spec version 1.11.0 but the output use version 1.9.1.
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
new file mode 100644
index 0000000..fc00145
--- /dev/null
+++ b/ld/testsuite/ld-riscv-elf/attr-merge-priv-spec-failed-02.d
@@ -0,0 +1,5 @@
+#source: attr-merge-priv-spec-c.s
+#source: attr-merge-priv-spec-a.s
+#as:
+#ld: -r
+#error: .*use privilege spec version 1.9.1 but the output use version 1.11.0.
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
new file mode 100644
index 0000000..1d40e90
--- /dev/null
+++ b/ld/testsuite/ld-riscv-elf/attr-merge-priv-spec-failed-03.d
@@ -0,0 +1,6 @@
+#source: attr-merge-priv-spec-a.s
+#source: attr-merge-priv-spec-d.s
+#source: attr-merge-priv-spec-c.s
+#as:
+#ld: -r
+#error: .*use privilege spec version 1.11.0 but the output use version 1.9.1.
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
new file mode 100644
index 0000000..0efee3c
--- /dev/null
+++ b/ld/testsuite/ld-riscv-elf/attr-merge-priv-spec-failed-04.d
@@ -0,0 +1,6 @@
+#source: attr-merge-priv-spec-d.s
+#source: attr-merge-priv-spec-a.s
+#source: attr-merge-priv-spec-c.s
+#as:
+#ld: -r
+#error: .*use privilege spec version 1.11.0 but the output use version 1.9.1.
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
new file mode 100644
index 0000000..5b9b8d0
--- /dev/null
+++ b/ld/testsuite/ld-riscv-elf/attr-merge-priv-spec-failed-05.d
@@ -0,0 +1,6 @@
+#source: attr-merge-priv-spec-c.s
+#source: attr-merge-priv-spec-d.s
+#source: attr-merge-priv-spec-a.s
+#as:
+#ld: -r
+#error: .*use privilege spec version 1.9.1 but the output use version 1.11.0.
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
new file mode 100644
index 0000000..dab7eb6
--- /dev/null
+++ b/ld/testsuite/ld-riscv-elf/attr-merge-priv-spec-failed-06.d
@@ -0,0 +1,6 @@
+#source: attr-merge-priv-spec-d.s
+#source: attr-merge-priv-spec-c.s
+#source: attr-merge-priv-spec-a.s
+#as:
+#ld: -r
+#error: .*use privilege spec version 1.9.1 but the output use version 1.11.0.
diff --git a/ld/testsuite/ld-riscv-elf/ld-riscv-elf.exp b/ld/testsuite/ld-riscv-elf/ld-riscv-elf.exp
index 0e9750e..1a0c68f 100644
--- a/ld/testsuite/ld-riscv-elf/ld-riscv-elf.exp
+++ b/ld/testsuite/ld-riscv-elf/ld-riscv-elf.exp
@@ -35,9 +35,17 @@ if [istarget "riscv*-*-*"] {
run_dump_test "attr-merge-strict-align-04"
run_dump_test "attr-merge-strict-align-05"
run_dump_test "attr-merge-stack-align"
- run_dump_test "attr-merge-priv-spec"
+ 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-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_ld_link_tests {
{ "Weak reference 32" "-T weakref.ld -melf32lriscv" ""
"-march=rv32i -mabi=ilp32" {weakref32.s}