diff options
author | Julian Brown <julian@codesourcery.com> | 2005-04-29 14:09:45 +0000 |
---|---|---|
committer | Julian Brown <jules@gcc.gnu.org> | 2005-04-29 14:09:45 +0000 |
commit | 7abc66b14227013a4dbb63b03e07d52931b58331 (patch) | |
tree | a069a1c7e66dac7e1d042f7a22530125e2918422 /gcc/crtstuff.c | |
parent | aa9dcfc4a46eddb8411f7affe732348f6a241c7d (diff) | |
download | gcc-7abc66b14227013a4dbb63b03e07d52931b58331.zip gcc-7abc66b14227013a4dbb63b03e07d52931b58331.tar.gz gcc-7abc66b14227013a4dbb63b03e07d52931b58331.tar.bz2 |
crtstuff.c: Handle targets that use .init_array.
* crtstuff.c: Handle targets that use .init_array.
* function.c (HAS_INIT_SECTION): Do not define. Instead, make sure
that INVOKE__main is set correctly.
(expand_main_function): Test INVOKE__main.
* libgcc2.c: Do not define __main when using .init_array.
* config/arm/arm.c (arm_elf_asm_constructor): New function.
* config/arm/arm.h (CTORS_SECTION_ASM_OP): Define, with specialized
libgcc version.
(DTORS_SECTION_ASM_OP): Likewise.
(CTOR_LIST_BEGIN): Define specially when in libgcc.
(CTOR_LIST_END): Likewise.
(DTOR_LIST_BEGIN): Likewise.
(DTOR_LIST_END): Likewise.
* config/arm/bpapi.h (INIT_SECTION_ASM_OP): Do not define it.
(FINI_SECTION_ASM_OP): Likewise.
(INIT_ARRAY_SECTION_ASM_OP): Define.
(FINI_ARRAY_SECTION_ASM_OP): Likewise.
* config/arm/elf.h (TARGET_ASM_CONSTRUCTOR): Define.
(SUPPORTS_INIT_PRIORITY): Evaluate to false for EABI based targets.
* doc/tm.texi (INIT_ARRAY_SECTION_ASM_OP): Document.
(FINI_ARRAY_SECTION_ASM_OP): Likewise.
Co-Authored-By: Mark Mitchell <mark@codesourcery.com>
Co-Authored-By: Paul Brook <paul@codesourcery.com>
From-SVN: r98986
Diffstat (limited to 'gcc/crtstuff.c')
-rw-r--r-- | gcc/crtstuff.c | 29 |
1 files changed, 26 insertions, 3 deletions
diff --git a/gcc/crtstuff.c b/gcc/crtstuff.c index 0e362f3..6fd3655 100644 --- a/gcc/crtstuff.c +++ b/gcc/crtstuff.c @@ -211,7 +211,7 @@ STATIC void *__JCR_LIST__[] = { }; #endif /* JCR_SECTION_NAME */ -#ifdef INIT_SECTION_ASM_OP +#if defined(INIT_SECTION_ASM_OP) || defined(INIT_ARRAY_SECTION_ASM_OP) #ifdef OBJECT_FORMAT_ELF @@ -256,9 +256,11 @@ extern void __cxa_finalize (void *) TARGET_ATTRIBUTE_WEAK; static void __attribute__((used)) __do_global_dtors_aux (void) { +#ifndef FINI_ARRAY_SECTION_ASM_OP static func_ptr *p = __DTOR_LIST__ + 1; - static _Bool completed; func_ptr f; +#endif /* !defined(FINI_ARRAY_SECTION_ASM_OP) */ + static _Bool completed; if (__builtin_expect (completed, 0)) return; @@ -268,11 +270,16 @@ __do_global_dtors_aux (void) __cxa_finalize (__dso_handle); #endif +#ifdef FINI_ARRAY_SECTION_ASM_OP + /* If we are using .fini_array then destructors will be run via that + mechanism. */ +#else /* !defined (FINI_ARRAY_SECTION_ASM_OP) */ while ((f = *p)) { p++; f (); } +#endif /* !defined(FINI_ARRAY_SECTION_ASM_OP) */ #ifdef USE_EH_FRAME_REGISTRY #ifdef CRT_GET_RFIB_DATA @@ -290,7 +297,13 @@ __do_global_dtors_aux (void) } /* Stick a call to __do_global_dtors_aux into the .fini section. */ +#ifdef FINI_SECTION_ASM_OP CRT_CALL_STATIC_FUNCTION (FINI_SECTION_ASM_OP, __do_global_dtors_aux) +#else /* !defined(FINI_SECTION_ASM_OP) */ +static func_ptr __do_global_dtors_aux_fini_array_entry[] + __attribute__ ((__unused__, section(".fini_array"))) + = { __do_global_dtors_aux }; +#endif /* !defined(FINI_SECTION_ASM_OP) */ #if defined(USE_EH_FRAME_REGISTRY) || defined(JCR_SECTION_NAME) /* Stick a call to __register_frame_info into the .init section. For some @@ -324,7 +337,13 @@ frame_dummy (void) #endif /* JCR_SECTION_NAME */ } +#ifdef INIT_SECTION_ASM_OP CRT_CALL_STATIC_FUNCTION (INIT_SECTION_ASM_OP, frame_dummy) +#else /* defined(INIT_SECTION_ASM_OP) */ +static func_ptr __frame_dummy_init_array_entry[] + __attribute__ ((__unused__, section(".init_array"))) + = { frame_dummy }; +#endif /* !defined(INIT_SECTION_ASM_OP) */ #endif /* USE_EH_FRAME_REGISTRY || JCR_SECTION_NAME */ #else /* OBJECT_FORMAT_ELF */ @@ -480,7 +499,11 @@ STATIC void *__JCR_END__[1] = { 0 }; #endif /* JCR_SECTION_NAME */ -#ifdef INIT_SECTION_ASM_OP +#ifdef INIT_ARRAY_SECTION_ASM_OP + +/* If we are using .init_array, there is nothing to do. */ + +#elif defined(INIT_SECTION_ASM_OP) #ifdef OBJECT_FORMAT_ELF static void __attribute__((used)) |