This is an archive of the discontinued LLVM Phabricator instance.

[LLD][ELF] Pre-create ThunkSections at Target specific intervals
AbandonedPublic

Authored by peter.smith on Apr 4 2017, 4:16 AM.

Details

Reviewers
ruiu
rafael
Summary

When an OutputSection is larger than the branch range for a Target we need to place thunks such that they are always in range of their caller, and sufficiently spaced to maximise the number of callers that can use the thunk. For ARMv7a we use the simple heuristic of placing the ThunkSection at intervals corresponding to the Thumb2 branch range. If the OutputSection is small we put the thunks at the end of the executable sections.

There are many alternative strategies for Thunk placement to maximize reuse. I've gone for a simple implementation that places the majority of Thunks slightly less than the most common branch range into the OutputSection. I think that this will work well in the most common case, a single .text OutputSection.

Diff Detail

Event Timeline

peter.smith created this revision.Apr 4 2017, 4:16 AM
peter.smith updated this revision to Diff 94214.Apr 5 2017, 6:15 AM

Rebased to account for changes in D31654

peter.smith abandoned this revision.May 16 2017, 7:35 AM

I'm abandoning the range thunks implementation that inserts into OutputSections in favour of an implementation that inserts into InputSectionDescription.