diff options
author | Anthony Green <green@redhat.com> | 2001-08-08 23:33:51 +0000 |
---|---|---|
committer | Anthony Green <green@gcc.gnu.org> | 2001-08-08 23:33:51 +0000 |
commit | 6351543d13052c85f87b6e1e8af0273279a5c771 (patch) | |
tree | b2a3074871661348b009c02745413b72c17c05ab /gcc/crtstuff.c | |
parent | e8406c89d1aeb29b08924d191293dbb102051065 (diff) | |
download | gcc-6351543d13052c85f87b6e1e8af0273279a5c771.zip gcc-6351543d13052c85f87b6e1e8af0273279a5c771.tar.gz gcc-6351543d13052c85f87b6e1e8af0273279a5c771.tar.bz2 |
class.c (emit_register_classes): Use assemble_jcr if possible.
2001-08-08 Anthony Green <green@redhat.com>
* 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.
From-SVN: r44731
Diffstat (limited to 'gcc/crtstuff.c')
-rw-r--r-- | gcc/crtstuff.c | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/gcc/crtstuff.c b/gcc/crtstuff.c index 75e9441..c74377e 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 */ |