diff options
author | Alan Modra <amodra@gmail.com> | 2020-08-31 10:15:34 +0930 |
---|---|---|
committer | Alan Modra <amodra@gmail.com> | 2020-08-31 20:28:10 +0930 |
commit | 108f6f97bd862e969f898c1347903ae1cf38ead4 (patch) | |
tree | 756294e43df1d6061aba9d77aad1ea0e0c60c632 | |
parent | a148a448ec071faaf0af4d5eaad6178eded35477 (diff) | |
download | binutils-108f6f97bd862e969f898c1347903ae1cf38ead4.zip binutils-108f6f97bd862e969f898c1347903ae1cf38ead4.tar.gz binutils-108f6f97bd862e969f898c1347903ae1cf38ead4.tar.bz2 |
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.
-rw-r--r-- | bfd/ChangeLog | 6 | ||||
-rw-r--r-- | bfd/elfxx-ia64.c | 6 |
2 files changed, 9 insertions, 3 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog index 04f6f4c..85fd9f4 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,5 +1,11 @@ 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 * elf32-csky.c (csky_relocate_contents): Make relocation a bfd_vma, and similarly for variables dealing with overflow. diff --git a/bfd/elfxx-ia64.c b/bfd/elfxx-ia64.c index b2e55df..a559008 100644 --- a/bfd/elfxx-ia64.c +++ b/bfd/elfxx-ia64.c @@ -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; |