From a0c3f57468656239f0720772b25f80f98fec9386 Mon Sep 17 00:00:00 2001 From: geoffk Date: Thu, 7 Nov 2002 06:00:07 +0000 Subject: Index: ChangeLog 2002-11-05 Geoffrey Keating * config.gcc: Don't create crtbegin, crtend on Darwin; do create crt2.o. Rearrange t-darwin makefiles. * crtstuff.c [OBJECT_FORMAT_MACHO]: Delete. * unwind-dw2-fde-darwin.c: New. * unwind-dw2-fde-glibc.c: Correct comment. * unwind-dw2-fde.c (__register_frame_info_bases) [DWARF2_OBJECT_END_PTR_EXTENSION]: Clear fde_end. (classify_object_over_fdes): Use last_fde. (add_fdes): Likewise. (linear_search_fdes): Likewise. * unwind-dw2-fde.h (struct object) [DWARF2_OBJECT_END_PTR_EXTENSION]: Add fde_end field. (last_fde): New. * config/darwin.h (STARTFILE_SPEC): Include crt2.o not crtbegin.o. (ENDFILE_SPEC): No crtend.o. * config/t-darwin: New. * config/i386/t-darwin: Delete. * config/darwin-crt2.c: New. * config/rs6000/t-darwin: Delete contents duplicated in t-rs6000 or config/t-darwin. Index: testsuite/ChangeLog 2002-11-05 Geoffrey Keating * g++.old-deja/g++.eh/badalloc1.C: XFAIL excess errors test on Darwin. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@58877 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/crtstuff.c | 82 ---------------------------------------------------------- 1 file changed, 82 deletions(-) (limited to 'gcc/crtstuff.c') 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 */ -- cgit v1.2.3