Upstream version 10.39.225.0
[platform/framework/web/crosswalk.git] / src / native_client / pnacl / support / bitcode / unwind_stubs.c
index e1c0f0f..b02e8c9 100644 (file)
 #include <stdlib.h>
 #include <unistd.h>
 
-#define STUB(sym) \
-  void sym() { \
-    char msg[] = "Aborting: " #sym " called " \
-                 "(C++ exception handling is disabled)\n"; \
-    write(2, msg, sizeof(msg) - 1); \
-    abort(); \
-  }
-
-STUB(_Unwind_DeleteException)
-STUB(_Unwind_GetRegionStart)
-STUB(_Unwind_GetDataRelBase)
-STUB(_Unwind_GetGR)
-STUB(_Unwind_GetIP)
-STUB(_Unwind_GetIPInfo)
-STUB(_Unwind_GetTextRelBase)
-STUB(_Unwind_GetLanguageSpecificData)
-STUB(_Unwind_SetGR)
-STUB(_Unwind_SetIP)
-STUB(_Unwind_PNaClSetResult0)
-STUB(_Unwind_PNaClSetResult1)
-STUB(_Unwind_RaiseException)
-STUB(_Unwind_Resume_or_Rethrow)
-STUB(_Unwind_Resume)
-STUB(_Unwind_GetCFA)
-STUB(_Unwind_Backtrace)
+/*
+ * unwind.h will generate static definitions of some of the functions when
+ * the __arm__ macro is defined but we want to provide our own, exported
+ * stubs because this will be used as portable bitcode.
+ */
+#undef __arm__
+#include <unwind.h>
+
+#define STUB                                                      \
+  char msg1[] = "Aborting: ";                                     \
+  char msg2[] = " called (C++ exception handling is disabled)\n"; \
+  write(2, msg1, sizeof(msg1) - 1);                               \
+  write(2, __func__, sizeof(__func__) - 1);                       \
+  write(2, msg2, sizeof(msg2) - 1);                               \
+  abort();
+
+void _Unwind_DeleteException(struct _Unwind_Exception *e) {
+  STUB
+}
+
+_Unwind_Ptr _Unwind_GetRegionStart(struct _Unwind_Context *c) {
+  STUB
+}
+
+_Unwind_Ptr _Unwind_GetDataRelBase(struct _Unwind_Context *c) {
+  STUB
+}
+
+_Unwind_Word _Unwind_GetGR(struct _Unwind_Context *c, int i) {
+  STUB
+}
+
+_Unwind_Ptr _Unwind_GetIP(struct _Unwind_Context *c) {
+  STUB
+}
+
+_Unwind_Ptr _Unwind_GetIPInfo(struct _Unwind_Context *c, int *i) {
+  STUB
+}
+
+_Unwind_Ptr _Unwind_GetTextRelBase(struct _Unwind_Context *c) {
+  STUB
+}
+
+void *_Unwind_GetLanguageSpecificData(struct _Unwind_Context *c) {
+  STUB
+}
+
+void _Unwind_SetGR(struct _Unwind_Context *c, int i, _Unwind_Word w) {
+  STUB
+}
+
+void _Unwind_SetIP(struct _Unwind_Context *c, _Unwind_Ptr p) {
+  STUB
+}
+
+void _Unwind_PNaClSetResult0(struct _Unwind_Context *c, _Unwind_Word w) {
+  STUB
+}
+
+void _Unwind_PNaClSetResult1(struct _Unwind_Context *c, _Unwind_Word w) {
+  STUB
+}
+
+_Unwind_Reason_Code _Unwind_RaiseException(struct _Unwind_Exception *e) {
+  STUB
+}
+
+_Unwind_Reason_Code _Unwind_Resume_or_Rethrow(struct _Unwind_Exception *e) {
+  STUB
+}
+
+void _Unwind_Resume(struct _Unwind_Exception *e) {
+  STUB
+}
+
+_Unwind_Word _Unwind_GetCFA(struct _Unwind_Context *c) {
+  STUB
+}
+
+_Unwind_Reason_Code _Unwind_Backtrace(_Unwind_Trace_Fn fn, void *p) {
+  STUB
+}