[PATCH] D44966: ELF: Try to create last thunk section at ThunkSectionSpacing bytes before the end.

Peter Collingbourne via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 27 18:40:01 PDT 2018


pcc created this revision.
pcc added reviewers: ruiu, espindola, peter.smith.
Herald added subscribers: arichardson, javed.absar, emaste.

Now that we have the ability to create short thunks, it is beneficial
for thunk sections to be surrounded by ThunkSectionSpacing bytes
of code on both sides in order to increase the likelihood that the
distance from the thunk to the target will be sufficiently small to
allow for the creation of a short thunk. This is currently the case
for most thunks that we create, except for the last one, which could,
depending on the size of the output section, potentially appear near
the end and therefore have a relatively small amount of code after it.

This patch moves the last thunk section to ThunkSectionSpacing bytes
before the end of the output section, as long as the section is larger
than 2*ThunkSectionSpacing bytes. It reduces the size of Chromium
for Android's .text section by 32KB.

Depends on https://reviews.llvm.org/D44963


https://reviews.llvm.org/D44966

Files:
  lld/ELF/Relocations.cpp
  lld/test/ELF/arm-thumb-mix-range-thunk-os.s
  lld/test/ELF/arm-thumb-range-thunk-os.s

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D44966.140030.patch
Type: text/x-patch
Size: 8485 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180328/46c6e72d/attachment.bin>


More information about the llvm-commits mailing list