aboutsummaryrefslogtreecommitdiff
path: root/ld
diff options
context:
space:
mode:
authorMax Filippov <jcmvbkbc@gmail.com>2020-04-25 00:40:25 -0700
committerMax Filippov <jcmvbkbc@gmail.com>2020-04-29 18:34:23 -0700
commitd548f47df4d2e3d117d504a4c9977982c78a0556 (patch)
treee1dee17e4e4ef7333271c7b216105d2e146d9351 /ld
parent935f1f4ba35dc018ec6adbc1ba5f0787c84f273b (diff)
downloadgdb-d548f47df4d2e3d117d504a4c9977982c78a0556.zip
gdb-d548f47df4d2e3d117d504a4c9977982c78a0556.tar.gz
gdb-d548f47df4d2e3d117d504a4c9977982c78a0556.tar.bz2
xtensa: fix XTENSA_NDIFF handling for PR ld/25861
Fields marked with XTENSA_NDIFF relocations are not negated, they only have sign bits removed. Don't negate their values when relaxation is performed. Don't add sign bits when the value is zero. Report overflow when the result has negative sign but all significant bits are zero. 2020-04-29 Max Filippov <jcmvbkbc@gmail.com> bfd/ * elf32-xtensa.c (relax_section): Don't negate diff_value for XTENSA_NDIFF relocations. Don't add sign bits whe diff_value equals 0. Report overflow when the result has negative sign but all significant bits are zero. ld/ * testsuite/ld-xtensa/relax-diff1.d: New test definition. * testsuite/ld-xtensa/relax-diff1.s: New test source. * testsuite/ld-xtensa/relax-ndiff.d: New test definition. * testsuite/ld-xtensa/relax-ndiff.s: New test source. * testsuite/ld-xtensa/xtensa.exp: (relax-diff1) (relax-ndiff): New tests.
Diffstat (limited to 'ld')
-rw-r--r--ld/ChangeLog9
-rw-r--r--ld/testsuite/ld-xtensa/relax-diff1.d6
-rw-r--r--ld/testsuite/ld-xtensa/relax-diff1.s18
-rw-r--r--ld/testsuite/ld-xtensa/relax-ndiff.d6
-rw-r--r--ld/testsuite/ld-xtensa/relax-ndiff.s20
-rw-r--r--ld/testsuite/ld-xtensa/xtensa.exp2
6 files changed, 61 insertions, 0 deletions
diff --git a/ld/ChangeLog b/ld/ChangeLog
index ae587df..43825ee 100644
--- a/ld/ChangeLog
+++ b/ld/ChangeLog
@@ -1,3 +1,12 @@
+2020-04-29 Max Filippov <jcmvbkbc@gmail.com>
+
+ * testsuite/ld-xtensa/relax-diff1.d: New test definition.
+ * testsuite/ld-xtensa/relax-diff1.s: New test source.
+ * testsuite/ld-xtensa/relax-ndiff.d: New test definition.
+ * testsuite/ld-xtensa/relax-ndiff.s: New test source.
+ * testsuite/ld-xtensa/xtensa.exp: (relax-diff1)
+ (relax-ndiff): New tests.
+
2020-04-29 Stephen Casner <casner@acm.org>
PR 25829
diff --git a/ld/testsuite/ld-xtensa/relax-diff1.d b/ld/testsuite/ld-xtensa/relax-diff1.d
new file mode 100644
index 0000000..900b55b
--- /dev/null
+++ b/ld/testsuite/ld-xtensa/relax-diff1.d
@@ -0,0 +1,6 @@
+#as: --text-section-literals
+#ld:
+#objdump: -s
+#...
+ 410154 06fa0006 fffa.*
+#...
diff --git a/ld/testsuite/ld-xtensa/relax-diff1.s b/ld/testsuite/ld-xtensa/relax-diff1.s
new file mode 100644
index 0000000..6cc8e2b
--- /dev/null
+++ b/ld/testsuite/ld-xtensa/relax-diff1.s
@@ -0,0 +1,18 @@
+ .globl _start
+ .globl _ResetVector
+ .text
+_ResetVector:
+_start:
+ .literal_position
+ movi a2, 0x12345678
+ movi a2, 0x12345678
+1:
+ .space 250
+2:
+ .space 65530
+3:
+ .align 4
+ .byte 1b - 2b
+ .byte 2b - 1b
+ .short 2b - 3b
+ .short 3b - 2b
diff --git a/ld/testsuite/ld-xtensa/relax-ndiff.d b/ld/testsuite/ld-xtensa/relax-ndiff.d
new file mode 100644
index 0000000..2a1cfd3
--- /dev/null
+++ b/ld/testsuite/ld-xtensa/relax-ndiff.d
@@ -0,0 +1,6 @@
+#as: --text-section-literals
+#ld:
+#objdump: -s
+#...
+ 400074 fffffff6 0000000a fff6000a f60a.*
+#...
diff --git a/ld/testsuite/ld-xtensa/relax-ndiff.s b/ld/testsuite/ld-xtensa/relax-ndiff.s
new file mode 100644
index 0000000..4e4176b
--- /dev/null
+++ b/ld/testsuite/ld-xtensa/relax-ndiff.s
@@ -0,0 +1,20 @@
+ .globl _start
+ .globl _ResetVector
+ .text
+_ResetVector:
+_start:
+ .literal_position
+ movi a2, 0x12345678
+ movi a2, 0x12345678
+1:
+ .space 10
+2:
+ .space 10
+3:
+ .align 4
+ .word 1b - 2b
+ .word 3b - 2b
+ .short 1b - 2b
+ .short 3b - 2b
+ .byte 1b - 2b
+ .byte 3b - 2b
diff --git a/ld/testsuite/ld-xtensa/xtensa.exp b/ld/testsuite/ld-xtensa/xtensa.exp
index de39887..5334bc6 100644
--- a/ld/testsuite/ld-xtensa/xtensa.exp
+++ b/ld/testsuite/ld-xtensa/xtensa.exp
@@ -27,7 +27,9 @@ run_dump_test "call_overflow"
run_dump_test "coalesce"
run_dump_test "diff_overflow"
run_dump_test "lcall"
+run_dump_test "relax-diff1"
run_dump_test "relax-loc"
+run_dump_test "relax-ndiff"
run_dump_test "relax-static-pie"
run_dump_test "relax-static-local-pie"