public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* PR26419, ASAN: mn10300_elf_relax_section elf-m10300.c:3943
@ 2020-08-25 13:26 Alan Modra
  0 siblings, 0 replies; only message in thread
From: Alan Modra @ 2020-08-25 13:26 UTC (permalink / raw)
  To: binutils

	PR 26419
	* elf-m10300.c (mn10300_elf_relax_section): Don't attempt access
	before start of section.

diff --git a/bfd/elf-m10300.c b/bfd/elf-m10300.c
index ae8cac84e6..7c63ce4cd1 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;
 
-- 
Alan Modra
Australia Development Lab, IBM

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2020-08-25 13:26 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-25 13:26 PR26419, ASAN: mn10300_elf_relax_section elf-m10300.c:3943 Alan Modra

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).