The main loop for range extension thunks will be something like.
assignAddresses(); while (createThunks()) { applySynthetic( ... ); assignAddresses(); }
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