This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] Use atexit vise .fini section for VMS port
- From: Douglas B Rupp <rupp at gnat dot com>
- To: Ian Lance Taylor <iant at google dot com>
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Thu, 27 Aug 2009 14:32:40 -0400
- Subject: Re: [PATCH] Use atexit vise .fini section for VMS port
- References: <4A678024.7050000@gnat.com> <m3eir0szy7.fsf@google.com>
Ian Lance Taylor wrote:
I don't think that VMS_DEBUGGING_INFO is a good macro to test. I
*think* it should work to test FINI_ARRAY_SECTION_ASM_OP here. Can you
look into that?
I've been looking into this as you suggested.
According to tm.texi: FINI_ARRAY_SECTION_ASM_OP: If defined, a C
expression whose value is a string, including spacing,
containing the assembler operation to identify the following data as
part of the @code{.fini_array} (or equivalent) section.
Where is this string output? Only it's existence is tested that I can find.
I reorganized the code as follows (my interpretation of your intent),
but seems like it should be outputting FINI_ARRAY_SECTION_ASM_OP rather
than just testing it???
config/arm/ababi.h is the only place I found where it might matter.
--Doug
--- gcc-head-src/gcc/crtstuff.c 2009-08-27 14:24:31.302038000 -0400
+++ gcc-head-src-new/gcc/crtstuff.c 2009-08-27 14:27:39.749794000 -0400
@@ -325,11 +325,18 @@ __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) */
+#elif defined (FINI_ARRAY_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) */
+#else /* !FINI_SECTION_ASM_OP && !FINI_ARRAY_SECTION_ASM_OP */
+static void __attribute__((used))
+__do_global_dtors_aux_1 (void)
+{
+ atexit (__do_global_dtors_aux);
+}
+CRT_CALL_STATIC_FUNCTION (INIT_SECTION_ASM_OP, __do_global_dtors_aux_1)
+#endif
#if defined(USE_EH_FRAME_REGISTRY) || defined(JCR_SECTION_NAME)
/* Stick a call to __register_frame_info into the .init section. For some