summaryrefslogtreecommitdiff
path: root/lib/csu/crtbeginS.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/csu/crtbeginS.c')
-rw-r--r--lib/csu/crtbeginS.c20
1 files changed, 19 insertions, 1 deletions
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();
}
}