From 00c91124d44f799a4fb9cd45a0ef44dc47ab1b1a Mon Sep 17 00:00:00 2001 From: Alan Modra Date: Tue, 1 Sep 2020 08:03:52 +0930 Subject: [PATCH] PR26423 UBSAN: elf32-arm.c:10237 left shift cannot be represented PR 26423 * elf32-arm.c (calculate_group_reloc_mask): Use 3u in shift. --- bfd/ChangeLog | 5 +++++ bfd/elf32-arm.c | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/bfd/ChangeLog b/bfd/ChangeLog index 861655c9de0..20918707f28 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,8 @@ +2020-09-01 Alan Modra + + PR 26423 + * elf32-arm.c (calculate_group_reloc_mask): Use 3u in shift. + 2020-08-31 Alan Modra PR 26493 diff --git a/bfd/elf32-arm.c b/bfd/elf32-arm.c index 24991898f70..4366b766361 100644 --- a/bfd/elf32-arm.c +++ b/bfd/elf32-arm.c @@ -10234,7 +10234,7 @@ calculate_group_reloc_mask (bfd_vma value, int n, bfd_vma *final_residual) /* Determine the most significant bit in the residual and align the resulting value to a 2-bit boundary. */ for (msb = 30; msb >= 0; msb -= 2) - if (residual & (3 << msb)) + if (residual & (3u << msb)) break; /* The desired shift is now (msb - 6), or zero, whichever -- 2.30.2