Loading...
src/dyldInitialization.cpp dyld-210.2.3 dyld-195.5
--- dyld/dyld-210.2.3/src/dyldInitialization.cpp
+++ dyld/dyld-195.5/src/dyldInitialization.cpp
@@ -31,6 +31,9 @@
 #include <mach-o/loader.h>
 #include <mach-o/ldsyms.h>
 #include <mach-o/reloc.h>
+#if __ppc__ || __ppc64__
+	#include <mach-o/ppc/reloc.h>
+#endif
 #if __x86_64__
 	#include <mach-o/x86_64/reloc.h>
 #endif
@@ -189,6 +192,10 @@
 	const relocation_info* const relocsStart = (struct relocation_info*)(linkEditSeg->vmaddr + slide + dynamicSymbolTable->locreloff - linkEditSeg->fileoff);
 	const relocation_info* const relocsEnd = &relocsStart[dynamicSymbolTable->nlocrel];
 	for (const relocation_info* reloc=relocsStart; reloc < relocsEnd; ++reloc) {
+	#if __ppc__ || __ppc64__ || __i36__
+		if ( (reloc->r_address & R_SCATTERED) != 0 )
+			throw "scattered relocation in dyld";
+	#endif
 		if ( reloc->r_length != RELOC_SIZE ) 
 			throw "relocation in dyld has wrong size";
 
@@ -201,6 +208,7 @@
 }
 
 
+extern "C" void dyld_exceptions_init(const struct macho_header*, uintptr_t slide); // in dyldExceptions.cpp
 extern "C" void mach_init();
 
 //
@@ -220,8 +228,7 @@
 //  In dyld we have to do this manually.
 //
 uintptr_t start(const struct macho_header* appsMachHeader, int argc, const char* argv[], 
-				intptr_t slide, const struct macho_header* dyldsMachHeader,
-				uintptr_t* startGlue)
+								intptr_t slide, const struct macho_header* dyldsMachHeader)
 {
 	// if kernel had to slide dyld, we need to fix up load sensitive locations
 	// we have to do this before using any global variables
@@ -235,6 +242,9 @@
 	_pthread_keys_init();
 #endif
 
+	// enable C++ exceptions to work inside dyld
+	dyld_exceptions_init(dyldsMachHeader, slide);
+	
 	// allow dyld to use mach messaging
 	mach_init();
 
@@ -251,7 +261,7 @@
 		
 	// now that we are done bootstrapping dyld, call dyld's main
 	uintptr_t appsSlide = slideOfMainExecutable(appsMachHeader);
-	return dyld::_main(appsMachHeader, appsSlide, argc, argv, envp, apple, startGlue);
+	return dyld::_main(appsMachHeader, appsSlide, argc, argv, envp, apple);
 }