diff options
Diffstat (limited to 'gcc/crtstuff.c')
-rw-r--r-- | gcc/crtstuff.c | 82 |
1 files changed, 0 insertions, 82 deletions
diff --git a/gcc/crtstuff.c b/gcc/crtstuff.c index 125e236ee9c..e5f5d78aeea 100644 --- a/gcc/crtstuff.c +++ b/gcc/crtstuff.c @@ -126,8 +126,6 @@ extern void *__deregister_frame_info_bases (void *) /* Likewise for _Jv_RegisterClasses. */ extern void _Jv_RegisterClasses (void *) TARGET_ATTRIBUTE_WEAK; -#ifndef OBJECT_FORMAT_MACHO - #ifdef OBJECT_FORMAT_ELF /* Declare a pointer to void function type. */ @@ -542,83 +540,3 @@ __do_global_ctors (void) #else /* ! CRT_BEGIN && ! CRT_END */ #error "One of CRT_BEGIN or CRT_END must be defined." #endif - -#else /* OBJECT_FORMAT_MACHO */ - -/* Crt stuff for Mach-O (NeXT and Darwin). - - The theory of this is that each dynamically-loadable module, - including the main program itself, must have been positioned by - dyld before any frame info can be registered. So we set up the - registration functions as dyld hooks, using a "preregistration" - function that is called directly from the system crt1.o. */ - -#ifdef CRT_BEGIN - -/* Homemade decls substituting for getsect.h and dyld.h, so cross - compilation works. */ -struct mach_header; -extern char *getsectdatafromheader (struct mach_header *, const char *, - const char *, unsigned long *); -extern void _dyld_register_func_for_add_image - (void (*) (struct mach_header *, unsigned long)); -extern void _dyld_register_func_for_remove_image - (void (*) (struct mach_header *, unsigned long)); - -extern void __darwin_gcc3_preregister_frame_info (void); - -static void -unwind_dyld_add_image_hook (struct mach_header *mh, - unsigned long vm_slide) -{ - unsigned long sz; - char *fde; - - fde = getsectdatafromheader (mh, "__TEXT", "__eh_frame", &sz); - if (fde) - { - struct object *ob = (struct object *) malloc (sizeof (struct object)); - - __register_frame_info (fde + vm_slide, ob); - } -} - -static void -unwind_dyld_remove_image_hook (struct mach_header *mh, - unsigned long vm_slide) -{ - unsigned long sz; - char *fde; - - fde = getsectdatafromheader (mh, "__TEXT", "__eh_frame", &sz); - - if (fde) - __deregister_frame_info (fde + vm_slide); -} - -/* Call this routine from the system crt1.o. The call is standard in - Darwin 6.x (Mac OS X 10.2) and later; for earlier systems, you - would need to modify crt.c in the Csu project. (This isn't great, - but other alternatives run afoul of linker semantics. This - function is declared as common and tested before being called, so - that programs compiled by older GCCs still link and run.) */ - -void -__darwin_gcc3_preregister_frame_info () -{ - _dyld_register_func_for_add_image (unwind_dyld_add_image_hook); - _dyld_register_func_for_remove_image (unwind_dyld_remove_image_hook); -} - -#elif defined(CRT_END) /* ! CRT_BEGIN */ - -/* Install a single zero word at the end of the __eh_frame section. */ - -asm (".section __TEXT,__eh_frame"); -asm (".long 0"); - -#else /* ! CRT_BEGIN && ! CRT_END */ -#error "One of CRT_BEGIN or CRT_END must be defined." -#endif - -#endif /* OBJECT_FORMAT_MACHO */ |