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.
This commit is contained in:
Alan Modra 2020-09-01 12:38:03 +09:30
parent 7af677524e
commit 821e059c26
3 changed files with 11 additions and 4 deletions

View file

@ -1,3 +1,9 @@
2020-09-01 Alan Modra <amodra@gmail.com>
* 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.
2020-09-01 Alan Modra <amodra@gmail.com>
PR 26429

View file

@ -1391,7 +1391,7 @@ static reloc_howto_type elf32_arm_howto_table_1[] =
0, /* bitsize */
FALSE, /* pc_relative */
0, /* bitpos */
complain_overflow_bitfield,/* complain_on_overflow */
complain_overflow_dont,/* complain_on_overflow */
bfd_elf_generic_reloc, /* special_function */
"R_ARM_TLS_DESCSEQ", /* name */
FALSE, /* partial_inplace */
@ -1683,7 +1683,7 @@ static reloc_howto_type elf32_arm_howto_table_1[] =
0, /* bitsize */
FALSE, /* pc_relative */
0, /* bitpos */
complain_overflow_bitfield,/* complain_on_overflow */
complain_overflow_dont,/* complain_on_overflow */
bfd_elf_generic_reloc, /* special_function */
"R_ARM_THM_TLS_DESCSEQ",/* name */
FALSE, /* partial_inplace */

View file

@ -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