ubsan elfnn-aarch64.c:7142 shift exponent 32 is too large

Alan Modra amodra@gmail.com
Wed Sep 2 08:42:46 GMT 2020
	* elfnn-aarch64.c (elfNN_aarch64_relocate_section): Correct type
	of constant shifted left.

diff --git a/bfd/elfnn-aarch64.c b/bfd/elfnn-aarch64.c
index 302d8dd7e6..5b4c189b59 100644
--- a/bfd/elfnn-aarch64.c
+++ b/bfd/elfnn-aarch64.c
@@ -7139,7 +7139,7 @@ elfNN_aarch64_relocate_section (bfd *output_bfd,
 
 		 Try to catch this situation here and provide a more helpful
 		 error message to the user.  */
-	      if (addend & ((1UL << howto->rightshift) - 1)
+	      if (addend & (((bfd_vma) 1 << howto->rightshift) - 1)
 		  /* FIXME: Are we testing all of the appropriate reloc
 		     types here ?  */
 		  && (real_r_type == BFD_RELOC_AARCH64_LD_LO19_PCREL
-- 
Alan Modra
Australia Development Lab, IBM



More information about the Binutils mailing list