[PATCH] D50076: [LLD][ELF][ARM] Add support for older Arm Architectures with smaller branch range

Peter Smith via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 31 09:02:03 PDT 2018


peter.smith created this revision.
peter.smith added reviewers: ruiu, grimar.
Herald added a reviewer: javed.absar.
Herald added subscribers: chrib, kristof.beyls, arichardson.
Herald added a reviewer: espindola.

The Thumb BL and BLX instructions on older Arm Architectures such as v5 and v6 have a constrained encoding that forces the https://reviews.llvm.org/J1 and https://reviews.llvm.org/J2 bits to be equal to 1. Later Architectures relaxed this restriction allowing https://reviews.llvm.org/J1 and https://reviews.llvm.org/J2 to be used to calculate a larger immediate.

      

This patch adds support for the old encoding when the build attributes for the input objects only contain older architectures. This permits the removal of the warning that LLD always uses the extended branch encoding. I've added --arm-add-build-attributes (generate build attributes from the --triple argument) to the llvm-mc arguments for existing tests that depend on the new encodings.

The https://reviews.llvm.org/J1 and https://reviews.llvm.org/J2 bits are defined in the Arm Architecture Reference Manual: https://developer.arm.com/products/architecture/cpu-architecture/a-profile/docs/ddi0406/latest/arm-architecture-reference-manual-armv7-a-and-armv7-r-edition (search for "BL, BLX (immediate)")

This is patch 1 of 2 to support Arm Architecture v5 and Arm Architecture v6 (as far as a linker is concerned there is no difference between v5 and v6). This will enable LLD to be used to target the first edition of the Raspberry Pi. Patch 2 adds v5/v6 compatible range extension Thunks.


https://reviews.llvm.org/D50076

Files:
  ELF/Arch/ARM.cpp
  ELF/Driver.cpp
  test/ELF/arm-bl-v6-inrange.s
  test/ELF/arm-bl-v6.s
  test/ELF/arm-blx-v4t.s
  test/ELF/arm-thumb-branch.s
  test/ELF/arm-thumb-condbranch-thunk.s
  test/ELF/arm-thumb-mix-range-thunk-os.s
  test/ELF/arm-thumb-plt-range-thunk-os.s
  test/ELF/arm-thumb-range-thunk-os.s
  test/ELF/arm-thumb-thunk-empty-pass.s
  test/ELF/arm-thunk-largesection.s
  test/ELF/arm-thunk-linkerscript-large.s
  test/ELF/arm-thunk-linkerscript-sort.s
  test/ELF/arm-thunk-multipass.s

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D50076.158288.patch
Type: text/x-patch
Size: 13665 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180731/f502d38f/attachment.bin>


More information about the llvm-commits mailing list