aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--bfd/ChangeLog6
-rw-r--r--bfd/elf32-avr.c2
-rw-r--r--ld/ChangeLog6
-rw-r--r--ld/testsuite/ld-avr/wraparound-range-boundary.d17
-rw-r--r--ld/testsuite/ld-avr/wraparound-range-boundary.s6
5 files changed, 36 insertions, 1 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index e463fed..0d7eda4 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,3 +1,9 @@
+2019-05-21 Senthil Kumar Selvaraj <senthilkumar.selvaraj@microchip.com>
+
+ PR ld/24564
+ * bfd/elf32-avr.c (avr_relative_distance_considering_wrap_around):
+ Wrap around even if distance equals avr_pc_wrap_around.
+
2019-05-20 Nick Clifton <nickc@redhat.com>
* po/fr.po: Updated French translation.
diff --git a/bfd/elf32-avr.c b/bfd/elf32-avr.c
index d6842a0..f8a843e 100644
--- a/bfd/elf32-avr.c
+++ b/bfd/elf32-avr.c
@@ -910,7 +910,7 @@ avr_relative_distance_considering_wrap_around (unsigned int distance)
unsigned int wrap_around_mask = avr_pc_wrap_around - 1;
int dist_with_wrap_around = distance & wrap_around_mask;
- if (dist_with_wrap_around > ((int) (avr_pc_wrap_around >> 1)))
+ if (dist_with_wrap_around >= ((int) (avr_pc_wrap_around >> 1)))
dist_with_wrap_around -= avr_pc_wrap_around;
return dist_with_wrap_around;
diff --git a/ld/ChangeLog b/ld/ChangeLog
index 594a304..20be135 100644
--- a/ld/ChangeLog
+++ b/ld/ChangeLog
@@ -1,3 +1,9 @@
+2019-05-21 Senthil Kumar Selvaraj <senthilkumar.selvaraj@microchip.com>
+
+ PR ld/24564
+ * testsuite/ld-avr/wraparound-range-boundary.d: New test.
+ * testsuite/ld-avr/wraparound-range-boundary.s: New test.
+
2019-05-20 Faraz Shahbazker <fshahbazker@wavecomp.com>
PR 14798
diff --git a/ld/testsuite/ld-avr/wraparound-range-boundary.d b/ld/testsuite/ld-avr/wraparound-range-boundary.d
new file mode 100644
index 0000000..83c12f5
--- /dev/null
+++ b/ld/testsuite/ld-avr/wraparound-range-boundary.d
@@ -0,0 +1,17 @@
+#name: Wraparound works for jump target at pc-relative range boundary
+#as: -m avr51
+#ld: --pmem-wrap-around=8k -m avr51
+#source: wraparound-range-boundary.s
+#objdump: -d
+#target: avr-*-*
+
+#...
+Disassembly of section .text:
+
+00000000 <__ctors_end>:
+ 0: 00 c8 rjmp .\-4096 ; 0xfffff002 <__eeprom_end\+0xff7ef002>
+ ...
+
+00001002 <target>:
+ ...
+
diff --git a/ld/testsuite/ld-avr/wraparound-range-boundary.s b/ld/testsuite/ld-avr/wraparound-range-boundary.s
new file mode 100644
index 0000000..fbea0e1
--- /dev/null
+++ b/ld/testsuite/ld-avr/wraparound-range-boundary.s
@@ -0,0 +1,6 @@
+.global main
+main:
+ rjmp target
+ .ds.b 4096
+target:
+ nop