diff options
Diffstat (limited to 'lib/csu')
-rw-r--r-- | lib/csu/crtbegin.c | 19 | ||||
-rw-r--r-- | lib/csu/crtbeginS.c | 20 | ||||
-rw-r--r-- | lib/csu/crtend.c | 7 | ||||
-rw-r--r-- | lib/csu/crtendS.c | 7 |
4 files changed, 49 insertions, 4 deletions
diff --git a/lib/csu/crtbegin.c b/lib/csu/crtbegin.c index 4c6eedcd94b..64bf618e77c 100644 --- a/lib/csu/crtbegin.c +++ b/lib/csu/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/crtbeginS.c b/lib/csu/crtbeginS.c index 693b7879a4a..80779c626c1 100644 --- a/lib/csu/crtbeginS.c +++ b/lib/csu/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/crtend.c b/lib/csu/crtend.c index 762b3c781bd..8c0d0726e84 100644 --- a/lib/csu/crtend.c +++ b/lib/csu/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/crtendS.c b/lib/csu/crtendS.c index 2701bf45b37..92493006494 100644 --- a/lib/csu/crtendS.c +++ b/lib/csu/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"); |