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.
This commit is contained in:
Alan Modra
2020-08-25 09:37:23 +09:30
parent 30b940a097
commit b8ff233b54
2 changed files with 8 additions and 2 deletions

View File

@ -1,3 +1,9 @@
2020-08-25 Alan Modra <amodra@gmail.com>
PR 26419
* elf-m10300.c (mn10300_elf_relax_section): Don't attempt access
before start of section.
2020-08-25 Alan Modra <amodra@gmail.com>
* elf-m10300.c (elf32_mn10300_hash_table): Test is_elf_hash_table

View File

@ -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;