Upstream version 5.34.92.0
[platform/framework/web/crosswalk.git] / src / native_client / pnacl / support / bitcode / sjlj_eh_redirect.c
1 /*
2  * Copyright (c) 2013 The Native Client Authors. All rights reserved.
3  * Use of this source code is governed by a BSD-style license that can be
4  * found in the LICENSE file.
5  */
6
7 /*
8  * This file defines _Unwind_RaiseException() etc. using the SJLJ
9  * (setjmp()/longjmp()-based) versions provided by PNaCl's libstdc++.
10  *
11  * This allows a single build of libstdc++ to support both the SJLJ
12  * and non-SJLJ models of C++ exception handling.  The SJLJ version is
13  * enabled by linking in this redirection file.
14  */
15
16 #include <stdlib.h>
17
18
19 struct _Unwind_Exception;
20
21 int __pnacl_eh_sjlj_Unwind_RaiseException(struct _Unwind_Exception *exc);
22 int __pnacl_eh_sjlj_Unwind_Resume_or_Rethrow(struct _Unwind_Exception *exc);
23 void __pnacl_eh_sjlj_Unwind_DeleteException(struct _Unwind_Exception *exc);
24 void __pnacl_eh_sjlj_cxa_call_unexpected(struct _Unwind_Exception *exc);
25
26
27 int _Unwind_RaiseException(struct _Unwind_Exception *exc) {
28   return __pnacl_eh_sjlj_Unwind_RaiseException(exc);
29 }
30
31 int _Unwind_Resume_or_Rethrow(struct _Unwind_Exception *exc) {
32   return __pnacl_eh_sjlj_Unwind_Resume_or_Rethrow(exc);
33 }
34
35 void _Unwind_DeleteException(struct _Unwind_Exception *exc) {
36   __pnacl_eh_sjlj_Unwind_DeleteException(exc);
37 }
38
39 void __cxa_call_unexpected(struct _Unwind_Exception *exc) {
40   __pnacl_eh_sjlj_cxa_call_unexpected(exc);
41 }
42
43 /*
44  * This is a dummy version of the C++ personality function to prevent
45  * libstdc++'s eh_personality.cc from being linked in, since that file
46  * also defines __cxa_call_unexpected(), which would clash with our
47  * definition above.
48  *
49  * The only references to this personality function will be from LLVM
50  * "landingpad" instructions, which will be removed by the PNaClSjLjEH
51  * pass.
52  */
53 void __gxx_personality_v0() {
54   abort();
55 }