diff options
Diffstat (limited to 'bfd')
-rw-r--r-- | bfd/ChangeLog | 6 | ||||
-rw-r--r-- | bfd/elf32-arm.c | 18 |
2 files changed, 21 insertions, 3 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog index 414646c..6ac8b96 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,9 @@ +2022-03-18 Viorel Preoteasa <viorel.preoteasa@gmail.com> + + PR 28924 + * elf32-arm.c (THM_MAX_FWD_BRANCH_OFFSET): Fix definition. + (THM2_MAX_FWD_BRANCH_OFFSET): Likewise. + 2022-03-16 Simon Marchi <simon.marchi@efficios.com> * Makefile.am (ALL_MACHINES, ALL_MACHINES_CFILES): diff --git a/bfd/elf32-arm.c b/bfd/elf32-arm.c index 616efe6..5b8f5e5 100644 --- a/bfd/elf32-arm.c +++ b/bfd/elf32-arm.c @@ -2536,11 +2536,23 @@ static const bfd_vma elf32_arm_nacl_plt_entry [] = 0xea000000, /* b .Lplt_tail */ }; +/* PR 28924: + There was a bug due to too high values of THM_MAX_FWD_BRANCH_OFFSET and + THM2_MAX_FWD_BRANCH_OFFSET. The first macro concerns the case when Thumb-2 + is not available, and second macro when Thumb-2 is available. Among other + things, they affect the range of branches represented as BLX instructions + in Encoding T2 defined in Section A8.8.25 of the ARM Architecture + Reference Manual ARMv7-A and ARMv7-R edition issue C.d. Such branches are + specified there to have a maximum forward offset that is a multiple of 4. + Previously, the respective values defined here were multiples of 2 but not + 4 and they are included in comments for reference. */ #define ARM_MAX_FWD_BRANCH_OFFSET ((((1 << 23) - 1) << 2) + 8) -#define ARM_MAX_BWD_BRANCH_OFFSET ((-((1 << 23) << 2)) + 8) -#define THM_MAX_FWD_BRANCH_OFFSET ((1 << 22) -2 + 4) +#define ARM_MAX_BWD_BRANCH_OFFSET ((-((1 << 23) << 2)) + 8) +#define THM_MAX_FWD_BRANCH_OFFSET ((1 << 22) - 4 + 4) +/* #def THM_MAX_FWD_BRANCH_OFFSET ((1 << 22) - 2 + 4) */ #define THM_MAX_BWD_BRANCH_OFFSET (-(1 << 22) + 4) -#define THM2_MAX_FWD_BRANCH_OFFSET (((1 << 24) - 2) + 4) +#define THM2_MAX_FWD_BRANCH_OFFSET (((1 << 24) - 4) + 4) +/* #def THM2_MAX_FWD_BRANCH_OFFSET (((1 << 24) - 2) + 4) */ #define THM2_MAX_BWD_BRANCH_OFFSET (-(1 << 24) + 4) #define THM2_MAX_FWD_COND_BRANCH_OFFSET (((1 << 20) -2) + 4) #define THM2_MAX_BWD_COND_BRANCH_OFFSET (-(1 << 20) + 4) |