sdk: C++ exeptions support

git-svn-id: svn://kolibrios.org@5963 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
Sergey Semyonov (Serge)
2015-12-14 17:41:20 +00:00
parent b340790ba4
commit b393c4e9d9
27 changed files with 3029 additions and 159 deletions

View File

@@ -1,6 +1,5 @@
/* Subroutines needed for unwinding stack frames for exception handling. */
/* Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2008,
2009 Free Software Foundation, Inc.
/* Copyright (C) 1997-2013 Free Software Foundation, Inc.
Contributed by Jason Merrill <jason@cygnus.com>.
This file is part of GCC.
@@ -64,6 +63,8 @@ init_object_mutex_once (void)
__gthread_once (&once, init_object_mutex);
}
#else
/* ??? Several targets include this file with stubbing parts of gthr.h
and expect no locking to be done. */
#define init_object_mutex_once()
#endif
@@ -227,7 +228,6 @@ __deregister_frame (void *begin)
free (__deregister_frame_info (begin));
}
/* Like base_of_encoded_value, but take the base from a struct object
instead of an _Unwind_Context. */
@@ -265,10 +265,18 @@ get_cie_encoding (const struct dwarf_cie *cie)
_sleb128_t stmp;
aug = cie->augmentation;
p = aug + strlen ((const char *)aug) + 1; /* Skip the augmentation string. */
if (__builtin_expect (cie->version >= 4, 0))
{
if (p[0] != sizeof (void *) || p[1] != 0)
return DW_EH_PE_omit; /* We are not prepared to handle unexpected
address sizes or segment selectors. */
p += 2; /* Skip address size and segment size. */
}
if (aug[0] != 'z')
return DW_EH_PE_absptr;
p = aug + strlen ((const char *)aug) + 1; /* Skip the augmentation string. */
p = read_uleb128 (p, &utmp); /* Skip code alignment. */
p = read_sleb128 (p, &stmp); /* Skip data alignment. */
if (cie->version == 1) /* Skip return address column. */
@@ -307,7 +315,7 @@ get_fde_encoding (const struct dwarf_fde *f)
return get_cie_encoding (get_cie (f));
}
/* Sorting an array of FDEs by address.
(Ideally we would have the linker sort the FDEs so we don't have to do
it at run time. But the linkers are not yet prepared for this.) */
@@ -614,6 +622,8 @@ classify_object_over_fdes (struct object *ob, const fde *this_fde)
{
last_cie = this_cie;
encoding = get_cie_encoding (this_cie);
if (encoding == DW_EH_PE_omit)
return -1;
base = base_from_object (encoding, ob);
if (ob->s.b.encoding == DW_EH_PE_omit)
ob->s.b.encoding = encoding;
@@ -723,10 +733,26 @@ init_object (struct object* ob)
{
fde **p = ob->u.array;
for (count = 0; *p; ++p)
count += classify_object_over_fdes (ob, *p);
{
size_t cur_count = classify_object_over_fdes (ob, *p);
if (cur_count == (size_t) -1)
goto unhandled_fdes;
count += cur_count;
}
}
else
count = classify_object_over_fdes (ob, ob->u.single);
{
count = classify_object_over_fdes (ob, ob->u.single);
if (count == (size_t) -1)
{
static const fde terminator;
unhandled_fdes:
ob->s.i = 0;
ob->s.b.encoding = DW_EH_PE_omit;
ob->u.single = &terminator;
return;
}
}
/* The count field we have in the main struct object is somewhat
limited, but should suffice for virtually all cases. If the