[SharedCache] Fix DSCObjCProcessor::PostProcessObjCSections
and improve Objective-C processing
#6198
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This pull request provides 3 commits that do the following:
DSCObjCProcessor::PostProcessObjCSections
never does anything because it doesn't use the correct names to get the Objective-C sections of the recently loaded library. In fact it never does anything because the DSC never has sections with the names its searching for. This commit passes thebaseName
(the name of the library that was loaded), which is what other Objective-C section processing code does. Combining the base name with the section names it will now find them and process them as intended. This was resulting in alot of Objective-C related stuff being missed.load_image_containing_address
orload_image_with_install_name
calledskipObjC
which defaults toFalse
. IfTrue
inSharedCache::LoadImageWithInstallName
the code that launches the Objective-C processor will be skipped. This provides users a way to manually defer Objective-C processing.process_objc_sections_for_image_with_install_name
for processing the Objective-C sections of single DSC library that has been loaded, andprocess_all_objc_sections
which will process Objective-C sections for all loaded libraries, even if they are only partially loaded.The C++ API was also updated to support the API changes.
The purpose of the API changes comes down to the fact that there is a problem with processing Objective-C sections. At the time a library is loaded some of the references within those sections may refer to unload sections. This results in things like selectors not being correctly typed and named. There is currently no way for a user to trigger re-processing of Objective-C sections once the required sections have also been loaded. This pull request solves that and in addition allows the user to defer Objective-C processing until all the images they want to load have been loaded. This is more performant than processing Objective-C sections after each image is loaded and then against once they've all been loaded.
The following Python code can be used to demonstrate the new API changes: