[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 11:05:00 PST 2019


peter.smith marked 2 inline comments as done.
peter.smith added a comment.

Thanks, I'll upload a new diff with the test changes.

To try and do a better job of explaining the logic.
The -fix-cortex-a53-843419 and -fix-cortex-a8 options are look for an instruction sequence that starts at a particular offset modulo 0x1000. For fix-cortex-a53-843419 the instruction sequence needs to start at 0xff8 (modulo 0x1000) or 0xffc (modulo 0x1000) for -fix-cortex-a8 the instruction sequence needs to start at 0xfffe (modulo 0x1000). When we add a thunk or a patch we displace the sections after them by the size of the content inserted. This can mean that some instruction sequences that were lined up over the 0xff8, 0xffc or 0xfffe are no longer lined up, and potentially there are new sequences that become lined up. Normally the patches get placed at the end of the .text section so this isn't a problem. However for large applications we need to insert the patches in between other .text sections, as well as having more range extension thunks. If we ensure that the thunk section size is rounded up to 0x1000 then the displacement of sections following the thunks does not change (modulo 0x1000), this means we don't generate more instruction sequences with the necessary offsets in the sections following the thunks.

I have a suspicion that the instrumented build, with lots of adrp, ldr, sequences possibly to counters triggers more erratum sequences than usual. I'd need to run some experiments to confirm.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D71281/new/

https://reviews.llvm.org/D71281





More information about the llvm-commits mailing list