[PATCH] D71281: [LLD][ELF][AArch64][ARM] When errata patching, round thunk size to page boundary

Peter Smith via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Dec 10 08:55:29 PST 2019


peter.smith created this revision.
peter.smith added reviewers: ruiu, grimar, MaskRay.
Herald added subscribers: kristof.beyls, arichardson, emaste.
Herald added a reviewer: espindola.
Herald added a project: LLVM.

On some edge cases such as Chromium compiled with full instrumentation we have a .text section over twice the size of the maximum branch range and the instrumentation code generation containing many examples of the erratum sequence. The combination of Thunks and many erratum sequences causes finalizeAddressDependentContent() to not converge. We have: 
start:

- Thunk Creation (disturbs addresses after thunks, creating more patches)
- Patch Creation (disturbs addresses after patches, creating more thunks)
- goto start

In most images with few thunks and patches the mutual disturbance does not cause convergence problems. As the .text size and number of patches go up the risk increases.

      

A way to prevent the thunk creation from interfering with patch creation is to round up the size of the thunks to a 4KiB boundary when the erratum patch is enabled. As the erratum sequence only triggers when an instruction sequence starts at 0xff8 or 0xffc modulo (4 KiB) by making the thunks not affect addresses modulo (4 KiB) we prevent thunks from
interfering.

      

The patch sections themselves could be aggregated in the same way that Thunks are within ThunkSections and have the size rounded up in the same way. This would reduce the number of patches created in a .text section size > 128 MiB but would not help with convergence problems.

fixes (part of) pr44071 Thunk convergence within limit.


https://reviews.llvm.org/D71281

Files:
  lld/ELF/SyntheticSections.cpp
  lld/ELF/SyntheticSections.h
  lld/test/ELF/aarch64-cortex-a53-843419-thunk.s
  lld/test/ELF/arm-fix-cortex-a8-thunk.s

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D71281.233120.patch
Type: text/x-patch
Size: 8192 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20191210/1e3ac666/attachment.bin>


More information about the llvm-commits mailing list