[PATCH] D72344: [LLD][ELF][ARM][AArch64] Only round up ThunkSection Size when large OS.

Peter Smith via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 7 09:27:42 PST 2020


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.

In D71281 <https://reviews.llvm.org/D71281> a fix was put in to round up the size of a ThunkSection to the nearest 4KiB when performing errata patching. This fixed a problem with a very large instrumented program that had thunks and patches mutually trigger each other. Unfortunately it triggers an assertion failure in an AArch64 allyesconfig build of the kernel. There is a specific assertion preventing an OutputSection being larger than 4KiB. This will always trigger if there is at least one Thunk needed, which is possible for an allyesconfig build.

      

The fix presented here limits the D71281 <https://reviews.llvm.org/D71281> fix to OutputSections larger than the ThunkSectionSpacing, as OutputSections smaller than this are not affected by the problem in D71281 <https://reviews.llvm.org/D71281>. We do this once in the constructor for ThunkSection as the value of OutputSection::size() is stable immediately after a call to assignAddresses(). We can't put the logic inside ThunkSection::getSize() as getSize() may be called during assignAddresses().

      

The fix reverts the two tests affected by D71281 <https://reviews.llvm.org/D71281> to their original state as they no longer need the 4KiB size roundup. I've added simpler tests to check for D71281 <https://reviews.llvm.org/D71281> when the OutputSection size is larger than the ThunkSection spacing.

      

Should Fix https://github.com/ClangBuiltLinux/linux/issues/812


https://reviews.llvm.org/D72344

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

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D72344.236611.patch
Type: text/x-patch
Size: 8227 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200107/d66e8039/attachment.bin>


More information about the llvm-commits mailing list