summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorMark Kettenis <kettenis@cvs.openbsd.org>2004-10-10 18:29:16 +0000
committerMark Kettenis <kettenis@cvs.openbsd.org>2004-10-10 18:29:16 +0000
commit84455c0072ffd85f36cee84c74247e5f3c121496 (patch)
tree14ab85d1fbf252e2f3928caa8022bfc9e415a3f4 /lib
parent0807b58aa571bc423da021673f9c6c3eaa0c292b (diff)
Add support for DWARF2 exception handling.
ok drahn@, millert@
Diffstat (limited to 'lib')
-rw-r--r--lib/csu/common_elf/crtbegin.c17
-rw-r--r--lib/csu/common_elf/crtend.c5
2 files changed, 20 insertions, 2 deletions
diff --git a/lib/csu/common_elf/crtbegin.c b/lib/csu/common_elf/crtbegin.c
index df53b5220b9..714ec10d4b5 100644
--- a/lib/csu/common_elf/crtbegin.c
+++ b/lib/csu/common_elf/crtbegin.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: crtbegin.c,v 1.9 2004/01/26 20:04:11 espie Exp $ */
+/* $OpenBSD: crtbegin.c,v 1.10 2004/10/10 18:29:15 kettenis Exp $ */
/* $NetBSD: crtbegin.c,v 1.1 1996/09/12 16:59:03 cgd Exp $ */
/*
@@ -45,6 +45,16 @@
#include "os-note-elf.h"
#include "extern.h"
+struct dwarf2_eh_object {
+ void *space[8];
+};
+
+extern void __register_frame_info(const void *,
+ struct dwarf2_eh_object *) __attribute__((weak));
+
+static const char __EH_FRAME_BEGIN__[]
+ __attribute__((section(".eh_frame"), aligned(4))) = { };
+
static const init_f __CTOR_LIST__[1]
__attribute__((section(".ctors"))) = { (void *)-1 }; /* XXX */
static const init_f __DTOR_LIST__[1]
@@ -95,6 +105,7 @@ void
__do_init()
{
static int initialized = 0;
+ static struct dwarf2_eh_object object;
/*
* Call global constructors.
@@ -102,6 +113,10 @@ __do_init()
*/
if (!initialized) {
initialized = 1;
+
+ if (__register_frame_info != NULL)
+ __register_frame_info(__EH_FRAME_BEGIN__, &object);
+
(__ctors)();
atexit(__fini);
diff --git a/lib/csu/common_elf/crtend.c b/lib/csu/common_elf/crtend.c
index 4f9cfe6deed..762b3c781bd 100644
--- a/lib/csu/common_elf/crtend.c
+++ b/lib/csu/common_elf/crtend.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: crtend.c,v 1.5 2004/01/26 20:04:11 espie Exp $ */
+/* $OpenBSD: crtend.c,v 1.6 2004/10/10 18:29:15 kettenis Exp $ */
/* $NetBSD: crtend.c,v 1.1 1996/09/12 16:59:04 cgd Exp $ */
#include <sys/cdefs.h>
@@ -10,5 +10,8 @@ static init_f __CTOR_LIST__[1]
static init_f __DTOR_LIST__[1]
__attribute__((section(".dtors"))) = { (void *)0 }; /* XXX */
+static const int __EH_FRAME_END__[]
+__attribute__((unused, mode(SI), section(".eh_frame"), aligned(4))) = { 0 };
+
MD_SECTION_EPILOGUE(".init");
MD_SECTION_EPILOGUE(".fini");