This is an archive of the discontinued LLVM Phabricator instance.

[LLD][ELF] Make createThunks a class [NFC]

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



The main loop for range extension thunks will be something like.

while (createThunks()) {
    applySynthetic( ... );

createThunks() will need to retain state about the Thunks that it has added so that it can reuse existing thunks. This change is a straight conversion of createThunks into a class so that the state can be retained across calls. The majority of the rangeThunks implementation will be extending this class.

I've kept the class in Relocations.h/Relocations.cpp. It may be better to move this to Thunks.h/Thunks.cpp, the only static functions from Relocations.hpp used will be fromPlt and toPlt.

Alternative ideas:

  • The class could be static so that createThunks() could remain the interface to it.
  • The state could be separated and passed in to createThunks as a parameter

Diff Detail

Event Timeline

peter.smith created this revision.Apr 4 2017, 3:03 AM
ruiu accepted this revision.Apr 4 2017, 4:58 PM



Remove == true.


Flip the condition and do continue early.


Please use more vertical space to layout code. I'd add a blank line here as this is the start of a class declaration. Also please add blank lines before comments.


So break them into three blocks.

This revision is now accepted and ready to land.Apr 4 2017, 4:58 PM
This revision was automatically updated to reflect the committed changes.