Loading...
src/ImageLoaderMachO.cpp dyld-96.2 dyld-95.3
--- dyld/dyld-96.2/src/ImageLoaderMachO.cpp
+++ dyld/dyld-95.3/src/ImageLoaderMachO.cpp
@@ -2459,7 +2459,7 @@
 {
 	if ( fReadOnlyImportSegment != NULL ) {
 		if ( fInSharedCache ) {
-			if ( context.startedInitializingMainExecutable ) {
+			if ( !context.linkingMainExecutable ) {
 				_spin_lock(&fgReadOnlyImportSpinLock);
 				context.makeSharedCacheImportSegmentsWritable(true);
 			}
@@ -2475,7 +2475,7 @@
 {
 	if ( fReadOnlyImportSegment != NULL ) {
 		if ( fInSharedCache ) {
-			if ( context.startedInitializingMainExecutable ) {
+			if ( !context.linkingMainExecutable ) {
 				context.makeSharedCacheImportSegmentsWritable(false);
 				_spin_unlock(&fgReadOnlyImportSpinLock);
 			}
@@ -2806,14 +2806,14 @@
 	return false;
 }
 
-void ImageLoaderMachO::doBindJustLazies(const LinkContext& context)
-{
-	// some API called requested that all lazy pointers in this image be force bound
-	this->doBindIndirectSymbolPointers(context, false, true, false);
-}
-
 void ImageLoaderMachO::doBind(const LinkContext& context, bool forceLazysBound)
 {
+	// check for runtime forcing of lazy pointers to be bound
+	if ( forceLazysBound && (this->getState() > dyld_image_state_bound) ) {
+		this->doBindIndirectSymbolPointers(context, false, forceLazysBound, false);
+		return;
+	}
+
 	// set dyld entry points in image
 	this->setupLazyPointerHandler(context);