[all-commits] [llvm/llvm-project] 7c8164: [COFF] Align ARM64 range extension thunks at instr...

Tom Tan via All-commits all-commits at lists.llvm.org
Fri Jan 10 19:19:50 PST 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: 7c816492197aefbaa2ea3ba0e391f7c6905956bc
      https://github.com/llvm/llvm-project/commit/7c816492197aefbaa2ea3ba0e391f7c6905956bc
  Author: Tom Tan <Tom.Tan at microsoft.com>
  Date:   2020-01-10 (Fri, 10 Jan 2020)

  Changed paths:
    M lld/COFF/Chunks.h
    M lld/test/COFF/arm64-thunks.s

  Log Message:
  -----------
  [COFF] Align ARM64 range extension thunks at instruction boundary

RangeExtensionThunkARM64 is created for out-of-range branches on Windows ARM64
because branch instructions has limited bits to encode target address.
Currently, RangeExtensionThunkARM64 is appended to its referencing COFF section
from object file at link time without any alignment requirement, so if size of
the preceding COFF section is not aligned to instruction boundary (4 bytes),
RangeExtensionThunkARM64 will emit thunk instructions at unaligned address
which is never a valid branch target on ARM64, and usually triggers invalid
instruction exception when branching to it.

This PR fixes it by requiring such thunks to align at 4 bytes.

Differential revision: https://reviews.llvm.org/D72473




More information about the All-commits mailing list