Loading...
src/dyldAPIs.cpp dyld-239.3 dyld-210.2.3
--- dyld/dyld-239.3/src/dyldAPIs.cpp
+++ dyld/dyld-210.2.3/src/dyldAPIs.cpp
@@ -147,7 +147,6 @@
 #if __IPHONE_OS_VERSION_MIN_REQUIRED	
 	{"__dyld_shared_cache_some_image_overridden",		(void*)dyld_shared_cache_some_image_overridden },
 #endif
-	{"__dyld_process_is_restricted",					(void*)dyld::processIsRestricted },
 
 	// deprecated
 #if DEPRECATED_APIS_SUPPORTED
@@ -240,9 +239,6 @@
 	const void*		imageBaseAddress;	// not used with OFI created from files
 	size_t			imageLength;		// not used with OFI created from files
 };
-
-
-VECTOR_NEVER_DESTRUCTED(NSObjectFileImage);
 static std::vector<NSObjectFileImage> sObjectFileImages;
 
 
@@ -546,7 +542,7 @@
 		if ( image != NULL ) {
 			if ( context.matchByInstallName )
 				image->setMatchInstallPath(true);
-			dyld::link(image, false, false, callersRPaths);
+			dyld::link(image, false, callersRPaths);
 			dyld::runInitializers(image);
 			// images added with NSAddImage() can never be unloaded
 			image->setNeverUnload(); 
@@ -976,9 +972,6 @@
 	
 	dyld::clearErrorMessage();
 	try {
-		if ( (options & NSLINKMODULE_OPTION_CAN_UNLOAD) != 0 )
-			objectFileImage->image->setCanUnload();
-
 		// NSLinkModule allows a bundle to be link multpile times
 		// each link causes the bundle to be copied to a new address
 		if ( objectFileImage->image->isLinked() ) {
@@ -1005,7 +998,7 @@
 		bool forceLazysBound = ( (options & NSLINKMODULE_OPTION_BINDNOW) != 0 );
 		
 		// load libraries, rebase, bind, to make this image usable
-		dyld::link(objectFileImage->image, forceLazysBound, false, ImageLoader::RPathChain(NULL,NULL));
+		dyld::link(objectFileImage->image, forceLazysBound, ImageLoader::RPathChain(NULL,NULL));
 		
 		// bump reference count to keep this bundle from being garbage collected
 		objectFileImage->image->incrementDlopenReferenceCount();
@@ -1051,7 +1044,7 @@
 			bool forceLazysBound = ( (options & NSLINKMODULE_OPTION_BINDNOW) != 0 );
 			
 			// load libraries, rebase, bind, to make this image usable
-			dyld::link(image, forceLazysBound, false, ImageLoader::RPathChain(NULL,NULL));
+			dyld::link(image, forceLazysBound, ImageLoader::RPathChain(NULL,NULL));
 			
 			// run initializers unless magic flag says not to
 			if ( (options & NSLINKMODULE_OPTION_DONT_CALL_MOD_INIT_ROUTINES) == 0 )
@@ -1114,7 +1107,6 @@
 	ImageLoader* image = NSModuleToImageLoader(module);
 	if ( image == NULL ) 
 		return false;
-	dyld::runImageTerminators(image);
 	dyld::removeImage(image);
 	
 	if ( (options & NSUNLINKMODULE_OPTION_KEEP_MEMORY_MAPPED) != 0 )
@@ -1190,9 +1182,9 @@
 	// If dyld is sending load/unload notices to CoreSymbolication, the shared memory
 	// page is not copied on fork. <rdar://problem/6797342>
  	// NULL the CoreSymbolication shared memory pointer to prevent a crash.
- 	dyld::gProcessInfo->coreSymbolicationShmPage = NULL;
+ 	dyld_all_image_infos.coreSymbolicationShmPage = NULL;
 	// for safety, make sure child starts with clean systemOrderFlag
-	dyld::gProcessInfo->systemOrderFlag = 0;
+	dyld_all_image_infos.systemOrderFlag = 0;
 }
 
 typedef void (*MonitorProc)(char *lowpc, char *highpc);
@@ -1270,7 +1262,7 @@
 	dyld::gLibSystemHelpers = helpers;
 	
 	// let gdb know it is safe to run code in inferior that might call malloc()
-	dyld::gProcessInfo->libSystemInitialized = true;	
+	dyld_all_image_infos.libSystemInitialized = true;	
 	
 #if __arm__
 	if ( helpers->version >= 5 )  {
@@ -1287,13 +1279,6 @@
 static void dlerrorClear()
 {
 	if ( dyld::gLibSystemHelpers != NULL ) {
-		// <rdar://problem/10595338> dlerror buffer leak
-		// dlerrorClear() should not force allocation, but zero it if already allocated
-		if ( dyld::gLibSystemHelpers->version >= 10 ) {
-			if ( ! (*dyld::gLibSystemHelpers->hasPerThreadBufferFor_dlerror)() )
-				return;
-		}
-
 		// first char of buffer is flag whether string (starting at second char) is valid
 		char* buffer = (*dyld::gLibSystemHelpers->getThreadBufferFor_dlerror)(2);
 		buffer[0] = '\0';
@@ -1483,7 +1468,7 @@
 			if ( (mode & RTLD_NOLOAD) == 0 ) {
 				bool alreadyLinked = image->isLinked();
 				bool forceLazysBound = ( (mode & RTLD_NOW) != 0 );
-				dyld::link(image, forceLazysBound, false, callersRPaths);
+				dyld::link(image, forceLazysBound, callersRPaths);
 				if ( ! alreadyLinked ) {
 					// only hide exports if image is not already in use
 					if ( (mode & RTLD_LOCAL) != 0 )
@@ -1529,12 +1514,9 @@
 			// load() succeeded but, link() failed
 			// back down reference count and do GC
 			image->decrementDlopenReferenceCount();
-			if ( image->dlopenCount() == 0 )
-				dyld::garbageCollectImages();
+			dyld::garbageCollectImages();
 		}
 		const char* str = dyld::mkstringf("dlopen(%s, %d): %s", path, mode, msg);
-		if ( dyld::gLogAPIs )
-			dyld::log("  %s() failed, error: '%s'\n", __func__, str);
 		dlerrorSet(str);
 		free((void*)str);
 		free((void*)msg); 	// our free() will do nothing if msg is a string literal
@@ -1555,8 +1537,6 @@
 		CRSetCrashLogMessage(NULL);
 		dyld::gLibSystemHelpers->releaseGlobalDyldLock();
 	}
-	if ( dyld::gLogAPIs && (result != NULL) )
-		dyld::log("  %s(%s) ==> %p\n", __func__, path, result);
 	return result;
 }
 
@@ -1582,8 +1562,7 @@
 			return -1;
 		}
 		// remove image if reference count went to zero
-		if ( image->dlopenCount() == 0 )
-			dyld::garbageCollectImages();
+		dyld::garbageCollectImages();
 		return 0;
 	}
 	else {
@@ -1643,12 +1622,6 @@
 		dyld::log("%s()\n", __func__);
 
 	if ( dyld::gLibSystemHelpers != NULL ) {
-		// if using newer libdyld.dylib and buffer if buffer not yet allocated, return NULL
-		if ( dyld::gLibSystemHelpers->version >= 10 ) {
-			if ( ! (*dyld::gLibSystemHelpers->hasPerThreadBufferFor_dlerror)() )
-				return NULL;
-		}
-
 		// first char of buffer is flag whether string (starting at second char) is valid
 		char* buffer = (*dyld::gLibSystemHelpers->getThreadBufferFor_dlerror)(2);
 		if ( buffer[0] != '\0' ) {	// if valid buffer
@@ -1768,7 +1741,7 @@
 
 const struct dyld_all_image_infos* _dyld_get_all_image_infos()
 {
-	return dyld::gProcessInfo;
+	return &dyld_all_image_infos;
 }
 
 #if !__arm__
@@ -1814,11 +1787,7 @@
 #if __IPHONE_OS_VERSION_MIN_REQUIRED	
 bool dyld_shared_cache_some_image_overridden()
 {
- #if DYLD_SHARED_CACHE_SUPPORT
 	return dyld::gSharedCacheOverridden;
- #else
-    return true;
- #endif
 }
 #endif