[all-commits] [llvm/llvm-project] 247b2c: [LLD][ELF][AArch64][ARM] Add missing classof to pa...

Peter Smith via All-commits all-commits at lists.llvm.org
Wed Dec 11 06:09:29 PST 2019


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: 247b2ce11cf0b9efeb3c1b0394dcc87ccab7be41
      https://github.com/llvm/llvm-project/commit/247b2ce11cf0b9efeb3c1b0394dcc87ccab7be41
  Author: Peter Smith <peter.smith at linaro.org>
  Date:   2019-12-11 (Wed, 11 Dec 2019)

  Changed paths:
    M lld/ELF/AArch64ErrataFix.cpp
    M lld/ELF/ARMErrataFix.cpp
    A lld/test/ELF/aarch64-cortex-a53-843419-thunk-range.s

  Log Message:
  -----------
  [LLD][ELF][AArch64][ARM] Add missing classof to patch sections.

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));
If the PatchSections don't implement classof this check fails if b is also
a SyntheticSection. This can result in the patches being out of range if
the SyntheticSection is big, for example a ThunkSection with lots of thunks.

Differential Revision: https://reviews.llvm.org/D71242

fixes (part of) pr44071


  Commit: 86d24193a9eb45d7bf3745fc2de96cd4e197b08a
      https://github.com/llvm/llvm-project/commit/86d24193a9eb45d7bf3745fc2de96cd4e197b08a
  Author: Peter Smith <peter.smith at linaro.org>
  Date:   2019-12-11 (Wed, 11 Dec 2019)

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

  Log Message:
  -----------
  [LLD][ELF][AArch64][ARM] When errata patching, round thunk size to 4KiB.

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 instrumented code generation containing many examples of the erratum
sequence. The combination of Thunks and many erratum sequences causes
finalizeAddressDependentContent() to not converge. We end up with:
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 with the patch.

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

Differential Revision: https://reviews.llvm.org/D71281

fixes (remaining part of) pr44071, other part in D71242


Compare: https://github.com/llvm/llvm-project/compare/c7738cca7efd...86d24193a9eb


More information about the All-commits mailing list