aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--bfd/ChangeLog6
-rw-r--r--bfd/elf32-arm.c4
-rw-r--r--bfd/reloc.c5
3 files changed, 11 insertions, 4 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index 1d65c68..4c152f5 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,5 +1,11 @@
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
* elf32-arm.c (elf32_arm_allocate_local_sym_info): Allocate arrays
in descending order of alignment.
diff --git a/bfd/elf32-arm.c b/bfd/elf32-arm.c
index 6202695..2f6bd88 100644
--- a/bfd/elf32-arm.c
+++ b/bfd/elf32-arm.c
@@ -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 */
diff --git a/bfd/reloc.c b/bfd/reloc.c
index 7d3479a..b17c5e6 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