[PATCH] D46306: [MC][ARM] Add range checking for Thumb2 resolved fixups

Peter Smith via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue May 1 04:28:57 PDT 2018


peter.smith created this revision.
peter.smith added reviewers: olista01, fhahn, t.p.northover, rengolin.
Herald added a reviewer: javed.absar.
Herald added subscribers: chrib, kristof.beyls.

When the branch target of a Thumb2 unconditional or conditonal branch is resolved at assembly time, no range checking is performed on the result leading to incorrect immediates when the maximum range is exceeded. This change adds a range check: +- 16 Megabytes for unconditional branches, +- 1 Megabyte for the conditional branch.

The ranges for the branch instructions can be found in https://developer.arm.com/docs/ddi0406/c/arm-architecture-reference-manual-armv7-a-and-armv7-r-edition
For version C (latest) the higher range can be found in A4.3 Branch instructions. The conditional branch range can be found in A8.8.18 B encoding T3.


https://reviews.llvm.org/D46306

Files:
  lib/Target/ARM/MCTargetDesc/ARMAsmBackend.cpp
  test/MC/ARM/thumb2-branch-ranges.s

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D46306.144691.patch
Type: text/x-patch
Size: 3256 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180501/ee55b66d/attachment.bin>


More information about the llvm-commits mailing list