Loading...
src/dyld.cpp dyld-96.2 dyld-95.3
--- dyld/dyld-96.2/src/dyld.cpp
+++ dyld/dyld-95.3/src/dyld.cpp
@@ -328,12 +328,8 @@
 //
 static void notifyAddImageCallbacks(ImageLoader* image)
 {
-	// use guard so that we cannot notify about the same image twice
-	if ( ! image->addFuncNotified() ) {
-		for (std::vector<ImageCallback>::iterator it=sAddImageCallbacks.begin(); it != sAddImageCallbacks.end(); it++)
-			(*it)(image->machHeader(), image->getSlide());
-		image->setAddFuncNotified();
-	}
+	for (std::vector<ImageCallback>::iterator it=sAddImageCallbacks.begin(); it != sAddImageCallbacks.end(); it++)
+		(*it)(image->machHeader(), image->getSlide());
 }
 
 
@@ -679,9 +675,6 @@
 
 void initializeMainExecutable()
 {
-
-	// record that we've reached this step
-	gLinkContext.startedInitializingMainExecutable = true;
 
 #if __i386__
 	// make all __IMPORT segments in the shared cache read-only
@@ -2083,21 +2076,6 @@
 	#define ARCH_CACHE_MAGIC	"dyld_v1  x86_64"
 #endif
 
-const void*	imMemorySharedCacheHeader()
-{
-	return sSharedCache;
-}
-
-int openSharedCacheFile()
-{
-#if __ppc__
-		// rosetta cannot handle optimized _ppc cache, so it use _rosetta cache instead, rdar://problem/5495438
-		if ( isRosetta() )
-			return ::open(DYLD_SHARED_CACHE_DIR DYLD_SHARED_CACHE_BASE_NAME ARCH_NAME_ROSETTA, O_RDONLY);
-		else
-#endif
-		return ::open(DYLD_SHARED_CACHE_DIR DYLD_SHARED_CACHE_BASE_NAME ARCH_NAME, O_RDONLY);
-}
 
 static void mapSharedCache()
 {	
@@ -2114,7 +2092,14 @@
 	}
 	else {
 		// map in shared cache to shared region
-		int fd = openSharedCacheFile();
+		int fd;
+#if __ppc__
+		// rosetta cannot handle optimized _ppc cache, so it use _rosetta cache instead, rdar://problem/5495438
+		if ( isRosetta() )
+			fd = open(DYLD_SHARED_CACHE_DIR DYLD_SHARED_CACHE_BASE_NAME ARCH_NAME_ROSETTA, O_RDONLY);
+		else
+#endif
+		fd = open(DYLD_SHARED_CACHE_DIR DYLD_SHARED_CACHE_BASE_NAME ARCH_NAME, O_RDONLY);
 		if ( fd != -1 ) {
 			uint8_t firstPage[4096];
 			if ( ::read(fd, firstPage, 4096) == 4096 ) {
@@ -2128,9 +2113,7 @@
 					if ( fstat(fd, &stat_buf) == 0 ) {
 						goodCache = true;
 						for (const shared_file_mapping_np* p = mappings; p < end; ++p) {
-							// rdar://problem/5694507 old update_dyld_shared_cache tool could make a cache file
-							// that is not page aligned, but otherwise ok.
-							if ( p->sfm_file_offset+p->sfm_size > (uint64_t)(stat_buf.st_size+4095 & (-4096)) )
+							if ( p->sfm_file_offset+p->sfm_size > (uint64_t)stat_buf.st_size )
 								goodCache = false;
 						}
 					}