diff options
author | Alan Modra <amodra@gmail.com> | 2020-09-01 12:38:03 +0930 |
---|---|---|
committer | Alan Modra <amodra@gmail.com> | 2020-09-01 16:02:48 +0930 |
commit | 821e059c2626fb0b2ee91898b1c74ea9636c6175 (patch) | |
tree | 8cce860547198f93e59039e1801ad8493da54ee1 /bfd/reloc.c | |
parent | 7af677524e205f3c343707d61bccd4dfd74089da (diff) | |
download | binutils-gdb-821e059c2626fb0b2ee91898b1c74ea9636c6175.tar.gz |
arm: ubsan: shift exponent 4G
* reloc.c (N_ONES): Handle N=0.
* elf32-arm.c (elf32_arm_howto_table_1): Set complain_overflow_dont
for R_ARM_TLS_DESCSEQ and R_ARM_THM_TLS_DESCSEQ.
Diffstat (limited to 'bfd/reloc.c')
-rw-r--r-- | bfd/reloc.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/bfd/reloc.c b/bfd/reloc.c index 7d3479acef4..b17c5e64ec9 100644 --- a/bfd/reloc.c +++ b/bfd/reloc.c @@ -432,8 +432,9 @@ DESCRIPTION . */ -/* N_ONES produces N one bits, without overflowing machine arithmetic. */ -#define N_ONES(n) (((((bfd_vma) 1 << ((n) - 1)) - 1) << 1) | 1) +/* N_ONES produces N one bits, without undefined behaviour for N + between zero and the number of bits in a bfd_vma. */ +#define N_ONES(n) ((n) == 0 ? 0 : ((bfd_vma) 1 << ((n) - 1) << 1) - 1) /* FUNCTION |