[PATCH] D31661: [LLD][ELF] Pre-create ThunkSections at Target specific intervals

Peter Smith via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Apr 4 04:16:53 PDT 2017


peter.smith created this revision.
Herald added subscribers: rengolin, aemerson.

When an OutputSection is larger than the branch range for a Target we need to place thunks such that they are always in range of their caller, and sufficiently spaced to maximise the number of callers that can use the thunk. For ARMv7a we use the simple heuristic of placing the ThunkSection at intervals corresponding to the Thumb2 branch range. If the OutputSection is small we put the thunks at the end of the executable sections.

There are many alternative strategies for Thunk placement to maximize reuse. I've gone for a simple implementation that places the majority of Thunks slightly less than the most common branch range into the OutputSection. I think that this will work well in the most common case, a single .text OutputSection.


https://reviews.llvm.org/D31661

Files:
  ELF/Relocations.cpp
  ELF/Relocations.h
  ELF/Target.h

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D31661.94040.patch
Type: text/x-patch
Size: 6160 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170404/ffa61151/attachment.bin>


More information about the llvm-commits mailing list