[PATCH] D71242: [LLD][ELF]{ARM][AArch64] Add missing classof to patch sections.

Peter Smith via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Dec 10 01:47:13 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.

The code to insert patch section merges them with a comparison function that uses logic of the form:

  return (isa<PatchSection>(a) && !isa<PatchSection>(b));

The PatchSections don't implement classof so this check fails if a is a PatchSection and b (is not a PatchSection, but is a SyntheticSection). This can result in relocations in the patches being out of range if the SyntheticSection is big, for example a ThunkSection with lots of thunks.

fixes part of pr44071 https://bugs.llvm.org/show_bug.cgi?id=44071 . Namely the relocation out of range errors. The convergence failures in pr44071 are a separate problem that will be addressed in a follow up patch.

The test case is a simulation of the Chromium build reported in pr44071 .  It will fail with relocation out of range errors without classof implemented. It isn't easy to replicate the out of range errors, it needs large thunk sections and a large number of patches. These won't be seen in the vast majority of AArch64 programs. The Chromium build in pr44071 is fully instrumented.

I've not got a real world example of the Arm Cortex-A8 patch failing, but it has the same code sequence so I've implemented the classof function. It is possible to write a test case, but it is difficult to find the right conditions to actually make it fail, I've erred on submitting the fix without one to unblock the Chromium team running into the problem.


https://reviews.llvm.org/D71242

Files:
  lld/ELF/AArch64ErrataFix.cpp
  lld/ELF/ARMErrataFix.cpp
  lld/test/ELF/aarch64-cortex-a53-843419-thunk-range.s

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D71242.233016.patch
Type: text/x-patch
Size: 3611 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20191210/3382283f/attachment.bin>


More information about the llvm-commits mailing list