From: Alan Modra Date: Tue, 25 Aug 2020 00:07:23 +0000 (+0930) Subject: PR26419, ASAN: mn10300_elf_relax_section elf-m10300.c:3943 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=b8ff233b54d66c5dce5a6d1409fe57e7ea359f43;p=binutils-gdb.git PR26419, ASAN: mn10300_elf_relax_section elf-m10300.c:3943 PR 26419 * elf-m10300.c (mn10300_elf_relax_section): Don't attempt access before start of section. --- diff --git a/bfd/ChangeLog b/bfd/ChangeLog index 0c638590fce..f1f0e322fe1 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,9 @@ +2020-08-25 Alan Modra + + PR 26419 + * elf-m10300.c (mn10300_elf_relax_section): Don't attempt access + before start of section. + 2020-08-25 Alan Modra * elf-m10300.c (elf32_mn10300_hash_table): Test is_elf_hash_table diff --git a/bfd/elf-m10300.c b/bfd/elf-m10300.c index ae8cac84e67..7c63ce4cd12 100644 --- a/bfd/elf-m10300.c +++ b/bfd/elf-m10300.c @@ -3932,7 +3932,7 @@ mn10300_elf_relax_section (bfd *abfd, /* See if the value will fit in 24 bits. We allow any 16bit match here. We prune those we can't handle below. */ - if ((long) value < 0x7fffff && (long) value > -0x800000) + if (value + 0x800000 < 0x1000000 && irel->r_offset >= 3) { unsigned char code; @@ -4003,7 +4003,7 @@ mn10300_elf_relax_section (bfd *abfd, /* See if the value will fit in 16 bits. We allow any 16bit match here. We prune those we can't handle below. */ - if ((long) value < 0x7fff && (long) value > -0x8000) + if (value + 0x8000 < 0x10000 && irel->r_offset >= 2) { unsigned char code;