[all-commits] [llvm/llvm-project] dd4d3f: [LLD][ELF][ARM] Fix case of patched unrelocated BLX

Peter Smith via All-commits all-commits at lists.llvm.org
Wed Jun 30 06:08:13 PDT 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: dd4d3f74062c64d57a5881dceac028ec6c231b73
      https://github.com/llvm/llvm-project/commit/dd4d3f74062c64d57a5881dceac028ec6c231b73
  Author: Peter Smith <peter.smith at arm.com>
  Date:   2021-06-30 (Wed, 30 Jun 2021)

  Changed paths:
    M lld/ELF/ARMErrataFix.cpp
    M lld/test/ELF/arm-fix-cortex-a8-blx.s

  Log Message:
  -----------
  [LLD][ELF][ARM] Fix case of patched unrelocated BLX

There are a couple of problems with the code to patch
unrelocated BLX instructions:
1. The calculation of the PC needs to take into account
   the alignment of the instruction. The Thumb BLX
   uses alignDown(PC, 4) for the source address.
2. The calculation of the PC bias is hard-coded to 4
   which works for Thumb, but when there is a BLX the
   branch will be in Arm state so it needs an 8 byte
   PC bias.

No asssembler generates an unrelocated BLX instruction
so these problems do not affect real world programs.
However we should still fix them.

Differential Revision: https://reviews.llvm.org/D104905




More information about the All-commits mailing list