diff options
author | Alan Modra <amodra@gmail.com> | 2019-05-15 16:31:28 +0930 |
---|---|---|
committer | Alan Modra <amodra@gmail.com> | 2019-05-15 16:36:00 +0930 |
commit | 3a1bb98c3c4f983b950fbaf2797ddcd21fcb5211 (patch) | |
tree | 965e03712156bf2aa276330c5443bc5ac5930b92 /bfd/elf32-arm.c | |
parent | 8f02ae5bac22b8d7f57f233ca1957ef9dbe751ab (diff) | |
download | gdb-3a1bb98c3c4f983b950fbaf2797ddcd21fcb5211.zip gdb-3a1bb98c3c4f983b950fbaf2797ddcd21fcb5211.tar.gz gdb-3a1bb98c3c4f983b950fbaf2797ddcd21fcb5211.tar.bz2 |
ARM STM32L4XX erratum test failure
Fixes a failure seen with MALLOC_PERTURB_=1.
* elf32-arm.c (elf32_arm_write_section): Don't leave
error case of STM32L4XX_ERRATUM_BRANCH_TO_VENEER with
unitialised section contents.
Diffstat (limited to 'bfd/elf32-arm.c')
-rw-r--r-- | bfd/elf32-arm.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/bfd/elf32-arm.c b/bfd/elf32-arm.c index 337961d..a8d5701 100644 --- a/bfd/elf32-arm.c +++ b/bfd/elf32-arm.c @@ -19693,6 +19693,9 @@ elf32_arm_write_section (bfd *output_bfd, bfd_vma branch_to_veneer = stm32l4xx_errnode->u.b.veneer->vma - stm32l4xx_errnode->vma; + /* The instruction is before the label. */ + target -= 4; + if ((signed) branch_to_veneer < -(1 << 24) || (signed) branch_to_veneer >= (1 << 24)) { @@ -19710,15 +19713,15 @@ elf32_arm_write_section (bfd *output_bfd, output_bfd, (uint64_t) (stm32l4xx_errnode->vma - 4), (int64_t) out_of_range); + + /* Don't leave contents uninitialised. */ + bfd_put_16 (output_bfd, 0, contents + target); continue; } insn = create_instruction_branch_absolute (stm32l4xx_errnode->u.b.veneer->vma - stm32l4xx_errnode->vma); - /* The instruction is before the label. */ - target -= 4; - put_thumb2_insn (globals, output_bfd, (bfd_vma) insn, contents + target); } |