From 2cee371fc4ff421e7ee390cec4b7f3b2cfa2a0f1 Mon Sep 17 00:00:00 2001 From: green Date: Wed, 8 Aug 2001 23:33:51 +0000 Subject: 2001-08-08 Anthony Green * java/class.c (emit_register_classes): Use assemble_jcr if possible. Keep the original mechanism as a fallback. * defaults.h (JCR_SECTION_NAME): Define if we have named section and weak symbol support. * crtstuff.c (__JCR_LIST__): Define. (__JCR_END__): Define. (_Jv_RegiserClasses): Define weak symbol if possible. (__do_global_ctors_aux): Register classes for ELF targets with weak symbol support. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@44731 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/crtstuff.c | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) (limited to 'gcc/crtstuff.c') diff --git a/gcc/crtstuff.c b/gcc/crtstuff.c index 75e944176c2..c74377eefee 100644 --- a/gcc/crtstuff.c +++ b/gcc/crtstuff.c @@ -415,6 +415,14 @@ char __EH_FRAME_BEGIN__[] = { }; #endif /* EH_FRAME_SECTION_NAME */ +#ifdef JCR_SECTION_NAME +/* Stick a label at the beginning of the java class registration info + so we can register them properly. */ + +STATIC void *__JCR_LIST__[] __attribute__ ((unused, section(JCR_SECTION_NAME))) + = { 0 }; +#endif /* JCR_SECTION_NAME */ + #endif /* defined(CRT_BEGIN) */ #ifdef CRT_END @@ -423,11 +431,25 @@ char __EH_FRAME_BEGIN__[] #ifdef OBJECT_FORMAT_ELF +#ifdef JCR_SECTION_NAME +extern void _Jv_RegisterClasses (void *) __attribute__((weak)); +static void *__JCR_END__[]; +#endif + static func_ptr __CTOR_END__[]; static void __do_global_ctors_aux (void) { func_ptr *p; +#ifdef JCR_SECTION_NAME + void **jcr; + if (_Jv_RegisterClasses) + { + for (jcr = __JCR_END__ - 1; *jcr != NULL; jcr--); + if (*(jcr + 1)) + _Jv_RegisterClasses (jcr + 1); + } +#endif for (p = __CTOR_END__ - 1; *p != (func_ptr) -1; p--) (*p) (); } @@ -543,6 +565,14 @@ STATIC int __FRAME_END__[] = { 0 }; #endif /* EH_FRAME_SECTION */ +#ifdef JCR_SECTION_NAME +/* Stick a label at the beginning of the java class registration info + so we can register them properly. */ + +STATIC void *__JCR_END__[1] + __attribute__ ((unused, section(JCR_SECTION_NAME))) = { 0 }; +#endif /* JCR_SECTION_NAME */ + #endif /* defined(CRT_END) */ #else /* OBJECT_FORMAT_MACHO */ -- cgit v1.2.3