Loading...
src/dyldAPIsInLibSystem.cpp dyld-195.6 dyld-132.13
--- dyld/dyld-195.6/src/dyldAPIsInLibSystem.cpp
+++ dyld/dyld-132.13/src/dyldAPIsInLibSystem.cpp
@@ -34,14 +34,9 @@
 
 #include "dyldLock.h"
 
-extern "C" int  __cxa_atexit(void (*func)(void *), void *arg, void *dso);
-extern "C" void __cxa_finalize(const void *dso);
-
-#ifndef LC_LOAD_UPWARD_DYLIB
-	#define	LC_LOAD_UPWARD_DYLIB (0x23|LC_REQ_DYLD)	/* load of dylib whose initializers run later */
-#endif
-
-#define DYLD_SHARED_CACHE_SUPPORT (__ppc__ || __i386__ || __ppc64__ || __x86_64__ || __arm__)
+extern "C" int __cxa_atexit(void (*func)(void *), void *arg, void *dso);
+
+#define DYLD_SHARED_CACHE_SUPPORT (__ppc__ || __i386__ || __ppc64__ || __x86_64__)
 
 // deprecated APIs are still availble on Mac OS X, but not on iPhone OS
 #if __IPHONE_OS_VERSION_MIN_REQUIRED	
@@ -109,16 +104,15 @@
 const NSLinkEditErrorHandlers* handlers)
 {
 	DYLD_LOCK_THIS_BLOCK;
-	typedef void (*ucallback_t)(const char* symbol_name);
- 	typedef NSModule (*mcallback_t)(NSSymbol s, NSModule old, NSModule newhandler);
-	typedef void (*lcallback_t)(NSLinkEditErrors c, int errorNumber,
-								const char* fileName, const char* errorString);
-	static void (*p)(ucallback_t undefined, mcallback_t multiple, lcallback_t linkEdit) = NULL;
+    static void (*p)(
+	void     (*undefined)(const char* symbol_name),
+	NSModule (*multiple)(NSSymbol s, NSModule old, NSModule newhandler),
+	void     (*linkEdit)(NSLinkEditErrors c, int errorNumber,
+		     const char* fileName, const char* errorString)) = NULL;
 
 	if(p == NULL)
 	    _dyld_func_lookup("__dyld_install_handlers", (void**)&p);
-	mcallback_t m = handlers->multiple;
-	p(handlers->undefined, m, handlers->linkEdit);
+	p(handlers->undefined, handlers->multiple, handlers->linkEdit);
 }
 
 const char* 
@@ -352,7 +346,6 @@
 		switch ( lc->cmd ) { 
 			case LC_LOAD_DYLIB:
 			case LC_LOAD_WEAK_DYLIB:
-			case LC_LOAD_UPWARD_DYLIB:
 				dl = (struct dylib_command *)lc;
 				install_name = (char *)dl + dl->dylib.name.offset;
 				if(names_match(install_name, libraryName) == TRUE)
@@ -772,8 +765,7 @@
 void (*func)(const struct mach_header *mh, intptr_t vmaddr_slide))
 {
 	DYLD_LOCK_THIS_BLOCK;
-	typedef void (*callback_t)(const struct mach_header *mh, intptr_t vmaddr_slide);
-    static void (*p)(callback_t func) = NULL;
+    static void (*p)(void (*func)(const struct mach_header *mh, intptr_t vmaddr_slide)) = NULL;
 
 	if(p == NULL)
 	    _dyld_func_lookup("__dyld_register_func_for_add_image", (void**)&p);
@@ -790,8 +782,7 @@
 void (*func)(const struct mach_header *mh, intptr_t vmaddr_slide))
 {
 	DYLD_LOCK_THIS_BLOCK;
-	typedef void (*callback_t)(const struct mach_header *mh, intptr_t vmaddr_slide);
-    static void (*p)(callback_t func) = NULL;
+    static void (*p)(void (*func)(const struct mach_header *mh, intptr_t vmaddr_slide)) = NULL;
 
 	if(p == NULL)
 	    _dyld_func_lookup("__dyld_register_func_for_remove_image", (void**)&p);
@@ -981,8 +972,7 @@
 void (*monaddition)(char *lowpc, char *highpc))
 {
 	DYLD_LOCK_THIS_BLOCK;
-	typedef void (*monproc)(char *lowpc, char *highpc);
-    static void (*p)(monproc monaddition) = NULL;
+    static void (*p)(void (*monaddition)(char *lowpc, char *highpc)) = NULL;
 
 	if(p == NULL)
 	    _dyld_func_lookup("__dyld_moninit", (void**)&p);
@@ -1077,7 +1067,7 @@
 
 
 // the table passed to dyld containing thread helpers
-static dyld::LibSystemHelpers sHelpers = { 8, &dyldGlobalLockAcquire, &dyldGlobalLockRelease,  
+static dyld::LibSystemHelpers sHelpers = { 6, &dyldGlobalLockAcquire, &dyldGlobalLockRelease,  
 									&getPerThreadBufferFor_dlerror, &malloc, &free, &__cxa_atexit,
 						#if DYLD_SHARED_CACHE_SUPPORT
 									&shared_cache_missing, &shared_cache_out_of_date,
@@ -1086,17 +1076,14 @@
 						#endif
 									NULL, NULL,
 									&pthread_key_create, &pthread_setspecific,
-									&malloc_size,
-									&pthread_getspecific,
-									&__cxa_finalize};
+									&malloc_size };
 
 
 //
 // during initialization of libSystem this routine will run
 // and call dyld, registering the helper functions.
 //
-extern "C" void tlv_initializer();
-extern "C" void _dyld_initializer();
+extern "C" void _dyld_initializer() __attribute__((visibility("hidden")));
 void _dyld_initializer()
 {
 	DYLD_LOCK_INITIALIZER;
@@ -1106,8 +1093,6 @@
 	_dyld_func_lookup("__dyld_register_thread_helpers", (void**)&p);
 	if(p != NULL)
 		p(&sHelpers);
-		
-	tlv_initializer();
 }
 
 
@@ -1202,6 +1187,7 @@
 }
 
 #if !__arm__
+__attribute__((visibility("hidden"))) 
 bool _dyld_find_unwind_sections(void* addr, dyld_unwind_sections* info)
 {
 	DYLD_NO_LOCK_THIS_BLOCK;
@@ -1214,7 +1200,7 @@
 #endif
 
 
-#if __i386__ || __x86_64__ || __arm__
+#if __i386__ || __x86_64__
 __attribute__((visibility("hidden"))) 
 void* _dyld_fast_stub_entry(void* loadercache, long lazyinfo)
 {
@@ -1238,30 +1224,4 @@
 	return p(addr);
 }
 
-#if __IPHONE_OS_VERSION_MIN_REQUIRED	
-bool dyld_shared_cache_some_image_overridden()
-{
-	DYLD_NO_LOCK_THIS_BLOCK;
-    static bool (*p)() = NULL;
-
-	if(p == NULL)
-	    _dyld_func_lookup("__dyld_shared_cache_some_image_overridden", (void**)&p);
-	return p();
-}
-#endif
-
-
-// SPI called __fork
-void _dyld_fork_child()
-{
-	DYLD_NO_LOCK_THIS_BLOCK;
-    static void (*p)() = NULL;
-
-	if(p == NULL)
-	    _dyld_func_lookup("__dyld_fork_child", (void**)&p);
-	return p();
-}
-
-
-
-
+