Skip to content
This repository was archived by the owner on Oct 5, 2021. It is now read-only.

Commit 1187265

Browse files
committed
[8-2018-q4-major] Patch binutils to fix the 32-bit objcopy
See https://sourceware.org/bugzilla/show_bug.cgi?id=24065 Signed-off-by: Frederic.Pillon <[email protected]>
1 parent 8a280cf commit 1187265

File tree

2 files changed

+55
-0
lines changed

2 files changed

+55
-0
lines changed
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
diff --git a/src/binutils/bfd/ChangeLog b/src/binutils/bfd/ChangeLog
2+
index 9acd28d..17eae57 100644
3+
--- a/src/binutils/bfd/ChangeLog
4+
+++ b/src/binutils/bfd/ChangeLog
5+
@@ -1,3 +1,10 @@
6+
+2019-01-08 Alan Modra <[email protected]>
7+
+
8+
+ PR 23699
9+
+ PR 24065
10+
+ * ihex.c (ihex_write_object_contents): Properly check 32-bit
11+
+ address range.
12+
+
13+
2018-12-11 Max Filippov <[email protected]>
14+
15+
* elf32-xtensa.c (elf_xtensa_do_reloc): Limit const16 opcode
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
diff --git a/src/binutils/bfd/ihex.c b/src/binutils/bfd/ihex.c
2+
index b576ac7..c85d60b 100644
3+
--- a/src/binutils/bfd/ihex.c
4+
+++ b/src/binutils/bfd/ihex.c
5+
@@ -775,15 +775,18 @@ ihex_write_object_contents (bfd *abfd)
6+
bfd_vma where;
7+
bfd_byte *p;
8+
bfd_size_type count;
9+
- const bfd_vma sign = (bfd_vma) 0xffffffff80000000ULL;
10+
- const bfd_vma top = (bfd_vma) 0xffffffff00000000ULL;
11+
12+
where = l->where;
13+
14+
- /* Check for unacceptable addresses sign extension.
15+
- See PR 23699 for more details. */
16+
- if ((where & sign) == top
17+
- || ((where & top) != 0 && (where & top) != top))
18+
+#ifdef BFD64
19+
+ /* IHex only supports 32-bit addresses, and we want to check
20+
+ that 64-bit addresses are in range. This isn't quite as
21+
+ obvious as it may seem, since some targets have 32-bit
22+
+ addresses that are sign extended to 64 bits. So complain
23+
+ only if addresses overflow both unsigned and signed 32-bit
24+
+ integers. */
25+
+ if (where > 0xffffffff
26+
+ && where + 0x80000000 > 0xffffffff)
27+
{
28+
_bfd_error_handler
29+
/* xgettext:c-format */
30+
@@ -792,9 +795,8 @@ ihex_write_object_contents (bfd *abfd)
31+
bfd_set_error (bfd_error_bad_value);
32+
return FALSE;
33+
}
34+
-
35+
where &= 0xffffffff;
36+
-
37+
+#endif
38+
p = l->data;
39+
count = l->size;
40+

0 commit comments

Comments
 (0)