Loading...
src/ImageLoaderMachOClassic.cpp dyld-239.3 dyld-210.2.3
--- dyld/dyld-239.3/src/ImageLoaderMachOClassic.cpp
+++ dyld/dyld-210.2.3/src/ImageLoaderMachOClassic.cpp
@@ -136,8 +136,11 @@
 		// record info about file  
 		image->setFileInfo(info.st_dev, info.st_ino, info.st_mtime);
 
+	#if CODESIGNING_SUPPORT
 		// if this image is code signed, let kernel validate signature before mapping any pages from image
-		image->loadCodeSignature(codeSigCmd, fd, offsetInFat, context);
+		if ( codeSigCmd != NULL )
+			image->loadCodeSignature(codeSigCmd, fd, offsetInFat);
+	#endif
 		
 		// mmap segments
 		image->mapSegmentsClassic(fd, offsetInFat, lenInFat, info.st_size, context);
@@ -950,7 +953,7 @@
 }
 
 
-uintptr_t ImageLoaderMachOClassic::exportedSymbolAddress(const LinkContext& context, const Symbol* symbol, const ImageLoader* requestor, bool runResolver) const
+uintptr_t ImageLoaderMachOClassic::exportedSymbolAddress(const LinkContext& context, const Symbol* symbol, bool runResolver) const
 {
 	const struct macho_nlist* sym = (macho_nlist*)symbol;
 	uintptr_t result = sym->n_value + fSlide;
@@ -1055,8 +1058,8 @@
 		}
 		const Symbol* sym;
 		if ( context.flatExportFinder(symbolName, &sym, foundIn) ) {
-			if ( *foundIn != this )
-				context.addDynamicReference(this, const_cast<ImageLoader*>(*foundIn));
+			if ( (*foundIn != this) && !(*foundIn)->neverUnload() )
+					this->addDynamicReference(*foundIn);
 			return (*foundIn)->getExportedSymbolAddress(sym, context, this);
 		}
 		// if a bundle is loaded privately the above will not find its exports
@@ -1078,8 +1081,8 @@
 		if ( !context.prebinding && !dontCoalesce && (symbolIsWeakReference(undefinedSymbol) || symbolIsWeakDefinition(undefinedSymbol)) ) {
 			const Symbol* sym;
 			if ( context.coalescedExportFinder(symbolName, &sym, foundIn) ) {
-				if ( *foundIn != this )
-					context.addDynamicReference(this, const_cast<ImageLoader*>(*foundIn));
+				if ( (*foundIn != this) && !(*foundIn)->neverUnload() )
+					this->addDynamicReference(*foundIn);
 				return (*foundIn)->getExportedSymbolAddress(sym, context, this);
 			}
 			//throwSymbolNotFound(context, symbolName, this->getPath(), "coalesced namespace");
@@ -1683,9 +1686,8 @@
 		}
 		cmd = (const struct load_command*)(((char*)cmd)+cmd->cmdsize);
 	}
-	if ( boundSomething && (targetImage != this) ) {
-		context.addDynamicReference(this, targetImage);
-	}
+	if ( boundSomething && (targetImage != this) && !targetImage->neverUnload() )
+		this->addDynamicReference(targetImage);
 	
 	// mark that this symbol has already been bound, so we don't try to bind again
 	it.type = 1;