diff options
author | Kurt Miller <kurt@cvs.openbsd.org> | 2009-04-13 20:15:25 +0000 |
---|---|---|
committer | Kurt Miller <kurt@cvs.openbsd.org> | 2009-04-13 20:15:25 +0000 |
commit | 9356401dfa136c8ac2aa9ff9742b450f3ce9584d (patch) | |
tree | f94b42c4afed3baec27547e130833f84463143a2 /lib | |
parent | 08a47d8286ecde4f4fdc9d2549824f6db3e7375b (diff) |
Add gcj java class registration hooks for gcc3 elf archs. From NetBSD
with minor differences.
okay kettenis@ drahn@
Diffstat (limited to 'lib')
-rw-r--r-- | lib/csu/common_elf/crtbegin.c | 19 | ||||
-rw-r--r-- | lib/csu/common_elf/crtbeginS.c | 20 | ||||
-rw-r--r-- | lib/csu/common_elf/crtend.c | 7 | ||||
-rw-r--r-- | lib/csu/common_elf/crtendS.c | 7 |
4 files changed, 49 insertions, 4 deletions
diff --git a/lib/csu/common_elf/crtbegin.c b/lib/csu/common_elf/crtbegin.c index 4c6eedcd94b..64bf618e77c 100644 --- a/lib/csu/common_elf/crtbegin.c +++ b/lib/csu/common_elf/crtbegin.c @@ -1,4 +1,4 @@ -/* $OpenBSD: crtbegin.c,v 1.12 2007/09/03 14:40:16 millert Exp $ */ +/* $OpenBSD: crtbegin.c,v 1.13 2009/04/13 20:15:24 kurt Exp $ */ /* $NetBSD: crtbegin.c,v 1.1 1996/09/12 16:59:03 cgd Exp $ */ /* @@ -60,6 +60,18 @@ static const char __EH_FRAME_BEGIN__[] __attribute__((section(".eh_frame"), aligned(4))) = { }; /* + * java class registration hooks + */ + +#if (__GNUC__ > 2) +static void *__JCR_LIST__[] + __attribute__((section(".jcr"), aligned(sizeof(void*)))) = { }; + +extern void _Jv_RegisterClasses (void *) + __attribute__((weak)); +#endif + +/* * Include support for the __cxa_atexit/__cxa_finalize C++ abi for * gcc > 2.x. __dso_handle is NULL in the main program and a unique * value for each C++ shared library. For more info on this API, see: @@ -133,6 +145,11 @@ __do_init() __register_frame_info(__EH_FRAME_BEGIN__, &object); +#if (__GNUC__ > 2) + if (__JCR_LIST__[0] && _Jv_RegisterClasses) + _Jv_RegisterClasses(__JCR_LIST__); +#endif + (__ctors)(); atexit(__fini); diff --git a/lib/csu/common_elf/crtbeginS.c b/lib/csu/common_elf/crtbeginS.c index 693b7879a4a..80779c626c1 100644 --- a/lib/csu/common_elf/crtbeginS.c +++ b/lib/csu/common_elf/crtbeginS.c @@ -1,4 +1,4 @@ -/* $OpenBSD: crtbeginS.c,v 1.9 2009/02/04 19:43:48 kettenis Exp $ */ +/* $OpenBSD: crtbeginS.c,v 1.10 2009/04/13 20:15:24 kurt Exp $ */ /* $NetBSD: crtbegin.c,v 1.1 1996/09/12 16:59:03 cgd Exp $ */ /* @@ -47,6 +47,18 @@ #include "extern.h" /* + * java class registration hooks + */ + +#if (__GNUC__ > 2) +static void *__JCR_LIST__[] + __attribute__((section(".jcr"), aligned(sizeof(void*)))) = { }; + +extern void _Jv_RegisterClasses (void *) + __attribute__((weak)); +#endif + +/* * Include support for the __cxa_atexit/__cxa_finalize C++ abi for * gcc > 2.x. __dso_handle is NULL in the main program and a unique * value for each C++ shared library. For more info on this API, see: @@ -118,6 +130,12 @@ _do_init(void) */ if (!initialized) { initialized = 1; + +#if (__GNUC__ > 2) + if (__JCR_LIST__[0] && _Jv_RegisterClasses) + _Jv_RegisterClasses(__JCR_LIST__); +#endif + __ctors(); } } diff --git a/lib/csu/common_elf/crtend.c b/lib/csu/common_elf/crtend.c index 762b3c781bd..8c0d0726e84 100644 --- a/lib/csu/common_elf/crtend.c +++ b/lib/csu/common_elf/crtend.c @@ -1,4 +1,4 @@ -/* $OpenBSD: crtend.c,v 1.6 2004/10/10 18:29:15 kettenis Exp $ */ +/* $OpenBSD: crtend.c,v 1.7 2009/04/13 20:15:24 kurt Exp $ */ /* $NetBSD: crtend.c,v 1.1 1996/09/12 16:59:04 cgd Exp $ */ #include <sys/cdefs.h> @@ -13,5 +13,10 @@ static init_f __DTOR_LIST__[1] static const int __EH_FRAME_END__[] __attribute__((unused, mode(SI), section(".eh_frame"), aligned(4))) = { 0 }; +#if (__GNUC__ > 2) +static void * __JCR_END__[] +__attribute__((unused, section(".jcr"), aligned(sizeof(void*)))) = { 0 }; +#endif + MD_SECTION_EPILOGUE(".init"); MD_SECTION_EPILOGUE(".fini"); diff --git a/lib/csu/common_elf/crtendS.c b/lib/csu/common_elf/crtendS.c index 2701bf45b37..92493006494 100644 --- a/lib/csu/common_elf/crtendS.c +++ b/lib/csu/common_elf/crtendS.c @@ -1,4 +1,4 @@ -/* $OpenBSD: crtendS.c,v 1.5 2004/01/26 20:04:11 espie Exp $ */ +/* $OpenBSD: crtendS.c,v 1.6 2009/04/13 20:15:24 kurt Exp $ */ /* $NetBSD: crtend.c,v 1.1 1997/04/16 19:38:24 thorpej Exp $ */ #include <sys/cdefs.h> @@ -10,5 +10,10 @@ static init_f __CTOR_LIST__[1] static init_f __DTOR_LIST__[1] __attribute__((section(".dtors"))) = { (void *)0 }; /* XXX */ +#if (__GNUC__ > 2) +static void * __JCR_END__[] +__attribute__((unused, section(".jcr"), aligned(sizeof(void*)))) = { 0 }; +#endif + MD_SECTION_EPILOGUE(".init"); MD_SECTION_EPILOGUE(".fini"); |