patch-include_unwind-cxx_h 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358
  1. diff -Nur uClibc++-0.2.2.orig/include/unwind-cxx.h uClibc++-0.2.2/include/unwind-cxx.h
  2. --- uClibc++-0.2.2.orig/include/unwind-cxx.h 2007-06-04 00:51:12.000000000 +0200
  3. +++ uClibc++-0.2.2/include/unwind-cxx.h 2010-07-31 09:31:32.416120094 +0200
  4. @@ -1,175 +1,179 @@
  5. -// -*- C++ -*- Exception handling and frame unwind runtime interface routines.
  6. -// Copyright (C) 2001 Free Software Foundation, Inc.
  7. -//
  8. -// This file is part of GCC.
  9. -//
  10. -// GCC is free software; you can redistribute it and/or modify
  11. -// it under the terms of the GNU General Public License as published by
  12. -// the Free Software Foundation; either version 2, or (at your option)
  13. -// any later version.
  14. -//
  15. -// GCC is distributed in the hope that it will be useful,
  16. -// but WITHOUT ANY WARRANTY; without even the implied warranty of
  17. -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  18. -// GNU General Public License for more details.
  19. -//
  20. -// You should have received a copy of the GNU General Public License
  21. -// along with GCC; see the file COPYING. If not, write to
  22. -// the Free Software Foundation, 59 Temple Place - Suite 330,
  23. -// Boston, MA 02111-1307, USA.
  24. -
  25. -// As a special exception, you may use this file as part of a free software
  26. -// library without restriction. Specifically, if other files instantiate
  27. -// templates or use macros or inline functions from this file, or you compile
  28. -// this file and link it with other files to produce an executable, this
  29. -// file does not by itself cause the resulting executable to be covered by
  30. -// the GNU General Public License. This exception does not however
  31. -// invalidate any other reasons why the executable file might be covered by
  32. -// the GNU General Public License.
  33. -
  34. -// This is derived from the C++ ABI for IA-64. Where we diverge
  35. -// for cross-architecture compatibility are noted with "@@@".
  36. -
  37. -#ifndef _UNWIND_CXX_H
  38. -#define _UNWIND_CXX_H 1
  39. -
  40. -// Level 2: C++ ABI
  41. -
  42. -#include <typeinfo>
  43. -#include <exception>
  44. -#include <cstddef>
  45. -#include "unwind.h"
  46. -
  47. -#pragma GCC visibility push(default)
  48. -
  49. -namespace __cxxabiv1
  50. -{
  51. -
  52. -// A C++ exception object consists of a header, which is a wrapper around
  53. -// an unwind object header with additional C++ specific information,
  54. -// followed by the exception object itself.
  55. -
  56. -struct __cxa_exception
  57. -{
  58. - // Manage the exception object itself.
  59. - std::type_info *exceptionType;
  60. - void (*exceptionDestructor)(void *);
  61. -
  62. - // The C++ standard has entertaining rules wrt calling set_terminate
  63. - // and set_unexpected in the middle of the exception cleanup process.
  64. - std::unexpected_handler unexpectedHandler;
  65. - std::terminate_handler terminateHandler;
  66. -
  67. - // The caught exception stack threads through here.
  68. - __cxa_exception *nextException;
  69. -
  70. - // How many nested handlers have caught this exception. A negated
  71. - // value is a signal that this object has been rethrown.
  72. - int handlerCount;
  73. -
  74. - // Cache parsed handler data from the personality routine Phase 1
  75. - // for Phase 2 and __cxa_call_unexpected.
  76. - int handlerSwitchValue;
  77. - const unsigned char *actionRecord;
  78. - const unsigned char *languageSpecificData;
  79. - _Unwind_Ptr catchTemp;
  80. - void *adjustedPtr;
  81. -
  82. - // The generic exception header. Must be last.
  83. - _Unwind_Exception unwindHeader;
  84. -};
  85. -
  86. -// Each thread in a C++ program has access to a __cxa_eh_globals object.
  87. -struct __cxa_eh_globals
  88. -{
  89. - __cxa_exception *caughtExceptions;
  90. - unsigned int uncaughtExceptions;
  91. -};
  92. -
  93. -
  94. -// The __cxa_eh_globals for the current thread can be obtained by using
  95. -// either of the following functions. The "fast" version assumes at least
  96. -// one prior call of __cxa_get_globals has been made from the current
  97. -// thread, so no initialization is necessary.
  98. -extern "C" __cxa_eh_globals *__cxa_get_globals () throw();
  99. -extern "C" __cxa_eh_globals *__cxa_get_globals_fast () throw();
  100. -
  101. -// Allocate memory for the exception plus the thown object.
  102. -extern "C" void *__cxa_allocate_exception(std::size_t thrown_size) throw();
  103. -
  104. -// Free the space allocated for the exception.
  105. -extern "C" void __cxa_free_exception(void *thrown_exception) throw();
  106. -
  107. -// Throw the exception.
  108. -extern "C" void __cxa_throw (void *thrown_exception,
  109. - std::type_info *tinfo,
  110. - void (*dest) (void *))
  111. - __attribute__((noreturn));
  112. -
  113. -// Used to implement exception handlers.
  114. -extern "C" void *__cxa_begin_catch (void *) throw();
  115. -extern "C" void __cxa_end_catch ();
  116. -extern "C" void __cxa_rethrow () __attribute__((noreturn));
  117. -
  118. -// These facilitate code generation for recurring situations.
  119. -extern "C" void __cxa_bad_cast ();
  120. -extern "C" void __cxa_bad_typeid ();
  121. -
  122. -// @@@ These are not directly specified by the IA-64 C++ ABI.
  123. -
  124. -// Handles re-checking the exception specification if unexpectedHandler
  125. -// throws, and if bad_exception needs to be thrown. Called from the
  126. -// compiler.
  127. -extern "C" void __cxa_call_unexpected (void *) __attribute__((noreturn));
  128. -
  129. -// Invokes given handler, dying appropriately if the user handler was
  130. -// so inconsiderate as to return.
  131. -extern void __terminate(std::terminate_handler) __attribute__((noreturn));
  132. -extern void __unexpected(std::unexpected_handler) __attribute__((noreturn));
  133. -
  134. -// The current installed user handlers.
  135. -extern std::terminate_handler __terminate_handler;
  136. -extern std::unexpected_handler __unexpected_handler;
  137. -
  138. -// These are explicitly GNU C++ specific.
  139. -
  140. -// This is the exception class we report -- "GNUCC++\0".
  141. -const _Unwind_Exception_Class __gxx_exception_class
  142. -= ((((((((_Unwind_Exception_Class) 'G'
  143. - << 8 | (_Unwind_Exception_Class) 'N')
  144. - << 8 | (_Unwind_Exception_Class) 'U')
  145. - << 8 | (_Unwind_Exception_Class) 'C')
  146. - << 8 | (_Unwind_Exception_Class) 'C')
  147. - << 8 | (_Unwind_Exception_Class) '+')
  148. - << 8 | (_Unwind_Exception_Class) '+')
  149. - << 8 | (_Unwind_Exception_Class) '\0');
  150. -
  151. -// GNU C++ personality routine, Version 0.
  152. -extern "C" _Unwind_Reason_Code __gxx_personality_v0
  153. - (int, _Unwind_Action, _Unwind_Exception_Class,
  154. - struct _Unwind_Exception *, struct _Unwind_Context *);
  155. -
  156. -// GNU C++ sjlj personality routine, Version 0.
  157. -extern "C" _Unwind_Reason_Code __gxx_personality_sj0
  158. - (int, _Unwind_Action, _Unwind_Exception_Class,
  159. - struct _Unwind_Exception *, struct _Unwind_Context *);
  160. -
  161. -// Acquire the C++ exception header from the C++ object.
  162. -static inline __cxa_exception *
  163. -__get_exception_header_from_obj (void *ptr)
  164. -{
  165. - return reinterpret_cast<__cxa_exception *>(ptr) - 1;
  166. -}
  167. -
  168. -// Acquire the C++ exception header from the generic exception header.
  169. -static inline __cxa_exception *
  170. -__get_exception_header_from_ue (_Unwind_Exception *exc)
  171. -{
  172. - return reinterpret_cast<__cxa_exception *>(exc + 1) - 1;
  173. -}
  174. -
  175. -} /* namespace __cxxabiv1 */
  176. -
  177. -#pragma GCC visibility pop
  178. -
  179. -#endif // _UNWIND_CXX_H
  180. +// -*- C++ -*- Exception handling and frame unwind runtime interface routines.
  181. +// Copyright (C) 2001 Free Software Foundation, Inc.
  182. +//
  183. +// This file is part of GCC.
  184. +//
  185. +// GCC is free software; you can redistribute it and/or modify
  186. +// it under the terms of the GNU General Public License as published by
  187. +// the Free Software Foundation; either version 2, or (at your option)
  188. +// any later version.
  189. +//
  190. +// GCC is distributed in the hope that it will be useful,
  191. +// but WITHOUT ANY WARRANTY; without even the implied warranty of
  192. +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  193. +// GNU General Public License for more details.
  194. +//
  195. +// You should have received a copy of the GNU General Public License
  196. +// along with GCC; see the file COPYING. If not, write to
  197. +// the Free Software Foundation, 59 Temple Place - Suite 330,
  198. +// Boston, MA 02111-1307, USA.
  199. +
  200. +// As a special exception, you may use this file as part of a free software
  201. +// library without restriction. Specifically, if other files instantiate
  202. +// templates or use macros or inline functions from this file, or you compile
  203. +// this file and link it with other files to produce an executable, this
  204. +// file does not by itself cause the resulting executable to be covered by
  205. +// the GNU General Public License. This exception does not however
  206. +// invalidate any other reasons why the executable file might be covered by
  207. +// the GNU General Public License.
  208. +
  209. +// This is derived from the C++ ABI for IA-64. Where we diverge
  210. +// for cross-architecture compatibility are noted with "@@@".
  211. +
  212. +#ifndef _UNWIND_CXX_H
  213. +#define _UNWIND_CXX_H 1
  214. +
  215. +// Level 2: C++ ABI
  216. +
  217. +#include <typeinfo>
  218. +#include <exception>
  219. +#include <cstddef>
  220. +#include "unwind.h"
  221. +
  222. +#pragma GCC visibility push(default)
  223. +
  224. +namespace __cxxabiv1
  225. +{
  226. +
  227. +// A C++ exception object consists of a header, which is a wrapper around
  228. +// an unwind object header with additional C++ specific information,
  229. +// followed by the exception object itself.
  230. +
  231. +struct __cxa_exception
  232. +{
  233. + // Manage the exception object itself.
  234. + std::type_info *exceptionType;
  235. + void (*exceptionDestructor)(void *);
  236. +
  237. + // The C++ standard has entertaining rules wrt calling set_terminate
  238. + // and set_unexpected in the middle of the exception cleanup process.
  239. + std::unexpected_handler unexpectedHandler;
  240. + std::terminate_handler terminateHandler;
  241. +
  242. + // The caught exception stack threads through here.
  243. + __cxa_exception *nextException;
  244. +
  245. + // How many nested handlers have caught this exception. A negated
  246. + // value is a signal that this object has been rethrown.
  247. + int handlerCount;
  248. +
  249. + // Cache parsed handler data from the personality routine Phase 1
  250. + // for Phase 2 and __cxa_call_unexpected.
  251. + int handlerSwitchValue;
  252. + const unsigned char *actionRecord;
  253. + const unsigned char *languageSpecificData;
  254. + _Unwind_Ptr catchTemp;
  255. + void *adjustedPtr;
  256. +
  257. + // The generic exception header. Must be last.
  258. + _Unwind_Exception unwindHeader;
  259. +};
  260. +
  261. +// Each thread in a C++ program has access to a __cxa_eh_globals object.
  262. +struct __cxa_eh_globals
  263. +{
  264. + __cxa_exception *caughtExceptions;
  265. + unsigned int uncaughtExceptions;
  266. +};
  267. +
  268. +
  269. +// The __cxa_eh_globals for the current thread can be obtained by using
  270. +// either of the following functions. The "fast" version assumes at least
  271. +// one prior call of __cxa_get_globals has been made from the current
  272. +// thread, so no initialization is necessary.
  273. +extern "C" __cxa_eh_globals *__cxa_get_globals () throw();
  274. +extern "C" __cxa_eh_globals *__cxa_get_globals_fast () throw();
  275. +
  276. +// Allocate memory for the exception plus the thown object.
  277. +extern "C" void *__cxa_allocate_exception(std::size_t thrown_size) throw();
  278. +
  279. +// Free the space allocated for the exception.
  280. +extern "C" void __cxa_free_exception(void *thrown_exception) throw();
  281. +
  282. +// Throw the exception.
  283. +extern "C" void __cxa_throw (void *thrown_exception,
  284. + std::type_info *tinfo,
  285. + void (*dest) (void *))
  286. + __attribute__((noreturn));
  287. +
  288. +// Used to implement exception handlers.
  289. +extern "C" void *__cxa_begin_catch (void *) throw();
  290. +extern "C" void __cxa_end_catch ();
  291. +extern "C" void __cxa_rethrow () __attribute__((noreturn));
  292. +
  293. +// These facilitate code generation for recurring situations.
  294. +extern "C" void __cxa_bad_cast ();
  295. +extern "C" void __cxa_bad_typeid ();
  296. +
  297. +// @@@ These are not directly specified by the IA-64 C++ ABI.
  298. +
  299. +// Handles re-checking the exception specification if unexpectedHandler
  300. +// throws, and if bad_exception needs to be thrown. Called from the
  301. +// compiler.
  302. +extern "C" void __cxa_call_unexpected (void *) __attribute__((noreturn));
  303. +
  304. +// Invokes given handler, dying appropriately if the user handler was
  305. +// so inconsiderate as to return.
  306. +extern void __terminate(std::terminate_handler) __attribute__((noreturn));
  307. +extern void __unexpected(std::unexpected_handler) __attribute__((noreturn));
  308. +
  309. +// The current installed user handlers.
  310. +extern std::terminate_handler __terminate_handler;
  311. +extern std::unexpected_handler __unexpected_handler;
  312. +
  313. +// These are explicitly GNU C++ specific.
  314. +
  315. +// This is the exception class we report -- "GNUCC++\0".
  316. +const _Unwind_Exception_Class __gxx_exception_class
  317. +#ifndef __ARM_EABI_UNWINDER__
  318. += ((((((((_Unwind_Exception_Class) 'G'
  319. + << 8 | (_Unwind_Exception_Class) 'N')
  320. + << 8 | (_Unwind_Exception_Class) 'U')
  321. + << 8 | (_Unwind_Exception_Class) 'C')
  322. + << 8 | (_Unwind_Exception_Class) 'C')
  323. + << 8 | (_Unwind_Exception_Class) '+')
  324. + << 8 | (_Unwind_Exception_Class) '+')
  325. + << 8 | (_Unwind_Exception_Class) '\0');
  326. +#else
  327. += "GNUC++";
  328. +#endif
  329. +
  330. +// GNU C++ personality routine, Version 0.
  331. +extern "C" _Unwind_Reason_Code __gxx_personality_v0
  332. + (int, _Unwind_Action, _Unwind_Exception_Class,
  333. + struct _Unwind_Exception *, struct _Unwind_Context *);
  334. +
  335. +// GNU C++ sjlj personality routine, Version 0.
  336. +extern "C" _Unwind_Reason_Code __gxx_personality_sj0
  337. + (int, _Unwind_Action, _Unwind_Exception_Class,
  338. + struct _Unwind_Exception *, struct _Unwind_Context *);
  339. +
  340. +// Acquire the C++ exception header from the C++ object.
  341. +static inline __cxa_exception *
  342. +__get_exception_header_from_obj (void *ptr)
  343. +{
  344. + return reinterpret_cast<__cxa_exception *>(ptr) - 1;
  345. +}
  346. +
  347. +// Acquire the C++ exception header from the generic exception header.
  348. +static inline __cxa_exception *
  349. +__get_exception_header_from_ue (_Unwind_Exception *exc)
  350. +{
  351. + return reinterpret_cast<__cxa_exception *>(exc + 1) - 1;
  352. +}
  353. +
  354. +} /* namespace __cxxabiv1 */
  355. +
  356. +#pragma GCC visibility pop
  357. +
  358. +#endif // _UNWIND_CXX_H