PR26461 UBSAN: elfxx-ia64.c:747 cannot be represented

PR 26461
	* elfxx-ia64.c (ia64_elf_install_value): Make expressions unsigned
	that might shift values into sign bit.
This commit is contained in:
Alan Modra 2020-08-31 10:15:34 +09:30
parent a148a448ec
commit 108f6f97bd
2 changed files with 9 additions and 3 deletions

View File

@ -1,3 +1,9 @@
2020-08-31 Alan Modra <amodra@gmail.com>
PR 26461
* elfxx-ia64.c (ia64_elf_install_value): Make expressions unsigned
that might shift values into sign bit.
2020-08-31 Alan Modra <amodra@gmail.com>
PR 26445

View File

@ -685,7 +685,7 @@ ia64_elf_install_value (bfd_byte *hit_addr, bfd_vma v, unsigned int r_type)
slot 2: bits 23..63 in t1 */
/* First, clear the bits that form the 64 bit constant. */
t0 &= ~(0x3ffffLL << 46);
t0 &= ~(0x3ffffULL << 46);
t1 &= ~(0x7fffffLL
| (( (0x07fLL << 13) | (0x1ffLL << 27)
| (0x01fLL << 22) | (0x001LL << 21)
@ -714,7 +714,7 @@ ia64_elf_install_value (bfd_byte *hit_addr, bfd_vma v, unsigned int r_type)
slot 2: bits 23..63 in t1 */
/* First, clear the bits that form the 64 bit constant. */
t0 &= ~(0x3ffffLL << 46);
t0 &= ~(0x3ffffULL << 46);
t1 &= ~(0x7fffffLL
| ((1LL << 36 | 0xfffffLL << 13) << 23));
@ -744,7 +744,7 @@ ia64_elf_install_value (bfd_byte *hit_addr, bfd_vma v, unsigned int r_type)
if (err)
return bfd_reloc_overflow;
dword &= ~(0x1ffffffffffLL << shift);
dword &= ~(0x1ffffffffffULL << shift);
dword |= (insn << shift);
bfd_putl64 (dword, hit_addr);
break;