PageRenderTime 58ms CodeModel.GetById 16ms RepoModel.GetById 0ms app.codeStats 0ms

/trunk/gcc-patches/gcc4.5/eh_shmem.patch

http://pcxprj.googlecode.com/
Patch | 594 lines | 543 code | 51 blank | 0 comment | 0 complexity | 060d522e025245a6bdfae6cd04b1683e MD5 | raw file
  1. # HG changeset patch
  2. # Parent 0128c92731b8c043818ff384a2baf895989a197f
  3. diff -r 0128c92731b8 gcc/config/i386/shmem-win32.c
  4. --- /dev/null Thu Jan 01 00:00:00 1970 +0000
  5. +++ b/gcc/config/i386/shmem-win32.c Tue Dec 21 20:56:42 2010 -0700
  6. @@ -0,0 +1,108 @@
  7. +/* -- shmem-win32.c --
  8. + *
  9. + * See gcc/shmem.h for a description of __SHMEM.
  10. + *
  11. + * This is the win32 implementation of __SHMEM, based in part on a mechanism
  12. + * originally developed by Thomas Pfaff and Adriano dos Santos Fernandes,
  13. + * reimplemented by JohnE as of 2010.
  14. + *
  15. + * This code is released into the public domain without warranty; it may be
  16. + * freely used and redistributed.
  17. + */
  18. +
  19. +
  20. +#include "shmem.h"
  21. +
  22. +#define WIN32_LEAN_AND_MEAN
  23. +#include <windows.h>
  24. +#include <malloc.h>
  25. +
  26. +
  27. +static const char* shmem_version_prefix = "gcc-shmem-tdm2";
  28. +
  29. +
  30. +static void __w32sp_trap(void)
  31. +{
  32. + asm("int $0x3");
  33. +}
  34. +
  35. +
  36. +static void* get_ptr_from_atom(ATOM atom, char* name_buf, int name_buf_len, int ptr_offset)
  37. +{
  38. + int ptr_len = sizeof(void*) * 8;
  39. + if (name_buf_len - ptr_offset < ptr_len)
  40. + __w32sp_trap();
  41. + if (!GetAtomNameA(atom, name_buf, name_buf_len))
  42. + __w32sp_trap();
  43. + size_t ptr = 0;
  44. + int i = 0;
  45. + for (; i < ptr_len; ++i)
  46. + {
  47. + if (name_buf[ptr_offset + i] == 'A')
  48. + ptr |= (1 << (ptr_len - i));
  49. + }
  50. + return (void*)ptr;
  51. +}
  52. +
  53. +
  54. +void* __shmem_grab(const char* name, int size, void (*initfunc)(void*))
  55. +{
  56. + int prefix_len = strlen(shmem_version_prefix);
  57. + int name_len = strlen(name);
  58. + int ptr_len = sizeof(void*) * 8;
  59. +
  60. + char full_atom_name[prefix_len + 1 + name_len + 1 + ptr_len + 1];
  61. +
  62. + memcpy(full_atom_name, shmem_version_prefix, prefix_len);
  63. + full_atom_name[prefix_len] = '-';
  64. + memcpy(full_atom_name + prefix_len + 1, name, name_len);
  65. + memset(full_atom_name + prefix_len + 1 + name_len + 1, 'a', ptr_len);
  66. + full_atom_name[prefix_len + 1 + name_len + 1 + ptr_len] = 0;
  67. +
  68. + full_atom_name[prefix_len + 1 + name_len] = 0;
  69. + HANDLE hmutex = CreateMutexA(0, FALSE, full_atom_name);
  70. + full_atom_name[prefix_len + 1 + name_len] = '-';
  71. + if (WaitForSingleObject(hmutex, INFINITE) != WAIT_OBJECT_0)
  72. + __w32sp_trap();
  73. +
  74. + ATOM atom = FindAtomA(full_atom_name);
  75. +
  76. + void* ret = 0;
  77. +
  78. + if (atom)
  79. + {
  80. + ret = get_ptr_from_atom(atom, full_atom_name,
  81. + prefix_len + 1 + name_len + 1 + ptr_len, prefix_len + 1 + name_len + 1);
  82. + }
  83. + else
  84. + {
  85. + void* shared_mem = malloc(size);
  86. +
  87. + int i = 0;
  88. + for (; i < ptr_len; ++i)
  89. + {
  90. + if ((((size_t)shared_mem) >> (ptr_len - i)) & 1)
  91. + full_atom_name[prefix_len + 1 + name_len + 1 + i] = 'A';
  92. + }
  93. +
  94. + atom = AddAtomA(full_atom_name);
  95. + if (!atom)
  96. + __w32sp_trap();
  97. +
  98. + ret = get_ptr_from_atom(atom, full_atom_name,
  99. + prefix_len + 1 + name_len + 1 + ptr_len, prefix_len + 1 + name_len + 1);
  100. + if (ret == shared_mem)
  101. + {
  102. + memset(ret, 0, size);
  103. + if (initfunc)
  104. + initfunc(ret);
  105. + }
  106. + else
  107. + free(shared_mem);
  108. + }
  109. +
  110. + ReleaseMutex(hmutex);
  111. + CloseHandle(hmutex);
  112. +
  113. + return ret;
  114. +}
  115. diff -r 0128c92731b8 gcc/config/i386/t-gthr-win32
  116. --- a/gcc/config/i386/t-gthr-win32 Mon Dec 20 17:17:01 2010 -0700
  117. +++ b/gcc/config/i386/t-gthr-win32 Tue Dec 21 20:56:42 2010 -0700
  118. @@ -1,2 +1,2 @@
  119. # We hide calls to w32api needed for w32 thread support here:
  120. -LIB2FUNCS_EXTRA = $(srcdir)/config/i386/gthr-win32.c
  121. +LIB2FUNCS_EXTRA += $(srcdir)/config/i386/gthr-win32.c
  122. diff -r 0128c92731b8 gcc/shmem.h
  123. --- /dev/null Thu Jan 01 00:00:00 1970 +0000
  124. +++ b/gcc/shmem.h Tue Dec 21 20:56:42 2010 -0700
  125. @@ -0,0 +1,98 @@
  126. +/* -- shmem.h --
  127. + *
  128. + * The __SHMEM mechanism is for sharing named pointers among the instances of a
  129. + * static library compiled into separate modules (binaries or shared libraries)
  130. + * in one runtime program. It's used in libgcc and libstdc++ to be able to
  131. + * propagate exceptions out of shared libraries even which libgcc and libstdc++
  132. + * are compiled in statically.
  133. + *
  134. + * This code is released into the public domain without warranty; it may be
  135. + * freely used and redistributed.
  136. + */
  137. +
  138. +
  139. +#if defined(_WIN32) || defined(_WIN64)
  140. +#define HAVE_SHMEM_IMPL
  141. +#endif
  142. +
  143. +
  144. +#if defined(HAVE_SHMEM_IMPL) && !defined(SHARED)
  145. +
  146. +
  147. +#ifdef __cplusplus
  148. +#define __SHMEM_CLINK extern "C"
  149. +#else
  150. +#define __SHMEM_CLINK
  151. +#endif
  152. +
  153. +
  154. +__SHMEM_CLINK void *__shmem_grab(const char *name, int size, void (*initfunc)(void *));
  155. +
  156. +
  157. +#define __SHMEM_CONCAT2(a, b) __CONCAT2_INDIR(a, b)
  158. +#define __CONCAT2_INDIR(a, b) a ## b
  159. +
  160. +
  161. +#define __SHMEM_DEFINE(type, name) \
  162. + type* __SHMEM_CONCAT2(__shmem_ptr_, name) = 0; \
  163. + type* __SHMEM_CONCAT2(__shmem_grabber_, name)() \
  164. + { \
  165. + return (type*)__shmem_grab(# name, sizeof(type), 0); \
  166. + }
  167. +
  168. +#define __SHMEM_DEFINE_INIT(type, name, initval) \
  169. + type* __SHMEM_CONCAT2(__shmem_ptr_, name) = 0; \
  170. + __SHMEM_CLINK void __SHMEM_CONCAT2(__shmem_init_, name)(void *mem) \
  171. + { \
  172. + type temp = initval; \
  173. + *((type*)mem) = temp; \
  174. + } \
  175. + type* __SHMEM_CONCAT2(__shmem_grabber_, name)() \
  176. + { \
  177. + return (type*)__shmem_grab(# name, sizeof(type), __SHMEM_CONCAT2(__shmem_init_, name)); \
  178. + }
  179. +
  180. +#define __SHMEM_DEFINE_ARRAY(type, name, size) \
  181. + type* __SHMEM_CONCAT2(__shmem_ptr_, name) = 0; \
  182. + type* __SHMEM_CONCAT2(__shmem_grabber_, name)() \
  183. + { \
  184. + return (type*)__shmem_grab(# name, sizeof(type) * size, 0); \
  185. + }
  186. +
  187. +
  188. +#define __SHMEM_DECLARE(type, name) \
  189. + extern type* __SHMEM_CONCAT2(__shmem_ptr_, name); \
  190. + type* __SHMEM_CONCAT2(__shmem_grabber_, name)();
  191. +
  192. +
  193. +#define __SHMEM_GET(name) \
  194. + (*( \
  195. + (__SHMEM_CONCAT2(__shmem_ptr_, name)) \
  196. + ? \
  197. + (__SHMEM_CONCAT2(__shmem_ptr_, name)) \
  198. + : \
  199. + ((__SHMEM_CONCAT2(__shmem_ptr_, name)) = __SHMEM_CONCAT2(__shmem_grabber_, name)()) \
  200. + ))
  201. +
  202. +#define __SHMEM_GET_ARRAY(name) \
  203. + ( \
  204. + (__SHMEM_CONCAT2(__shmem_ptr_, name)) \
  205. + ? \
  206. + (__SHMEM_CONCAT2(__shmem_ptr_, name)) \
  207. + : \
  208. + ((__SHMEM_CONCAT2(__shmem_ptr_, name)) = __SHMEM_CONCAT2(__shmem_grabber_, name)()) \
  209. + )
  210. +
  211. +
  212. +#else
  213. +
  214. +
  215. +#define __SHMEM_DEFINE(type, name) type name;
  216. +#define __SHMEM_DEFINE_INIT(type, name, initval) type name = initval;
  217. +#define __SHMEM_DEFINE_ARRAY(type, name, size) type name[size];
  218. +#define __SHMEM_DECLARE(type, name) extern type name;
  219. +#define __SHMEM_GET(name) name
  220. +#define __SHMEM_GET_ARRAY(name) name
  221. +
  222. +
  223. +#endif
  224. diff -r 0128c92731b8 gcc/unwind-dw2-fde.c
  225. --- a/gcc/unwind-dw2-fde.c Mon Dec 20 17:17:01 2010 -0700
  226. +++ b/gcc/unwind-dw2-fde.c Tue Dec 21 20:56:42 2010 -0700
  227. @@ -35,20 +35,24 @@
  228. #include "unwind-pe.h"
  229. #include "unwind-dw2-fde.h"
  230. #include "gthr.h"
  231. +#include "shmem.h"
  232. #endif
  233. /* The unseen_objects list contains objects that have been registered
  234. but not yet categorized in any way. The seen_objects list has had
  235. its pc_begin and count fields initialized at minimum, and is sorted
  236. by decreasing value of pc_begin. */
  237. -static struct object *unseen_objects;
  238. -static struct object *seen_objects;
  239. +__SHMEM_DEFINE(struct object *, unseen_objects)
  240. +#define unseen_objects __SHMEM_GET(unseen_objects)
  241. +__SHMEM_DEFINE(struct object *, seen_objects)
  242. +#define seen_objects __SHMEM_GET(seen_objects)
  243. #ifdef __GTHREAD_MUTEX_INIT
  244. -static __gthread_mutex_t object_mutex = __GTHREAD_MUTEX_INIT;
  245. +__SHMEM_DEFINE_INIT(__gthread_mutex_t, object_mutex, __GTHREAD_MUTEX_INIT)
  246. #else
  247. -static __gthread_mutex_t object_mutex;
  248. +__SHMEM_DEFINE(__gthread_mutex_t, object_mutex)
  249. #endif
  250. +#define object_mutex __SHMEM_GET(object_mutex)
  251. #ifdef __GTHREAD_MUTEX_INIT_FUNCTION
  252. static void
  253. @@ -57,11 +61,11 @@
  254. __GTHREAD_MUTEX_INIT_FUNCTION (&object_mutex);
  255. }
  256. +__SHMEM_DEFINE_INIT(__gthread_once_t, dw2_once, __GTHREAD_ONCE_INIT)
  257. static void
  258. init_object_mutex_once (void)
  259. {
  260. - static __gthread_once_t once = __GTHREAD_ONCE_INIT;
  261. - __gthread_once (&once, init_object_mutex);
  262. + __gthread_once (&__SHMEM_GET(dw2_once), init_object_mutex);
  263. }
  264. #else
  265. #define init_object_mutex_once()
  266. @@ -424,11 +428,13 @@
  267. chain to determine what should be placed in the ERRATIC array, and
  268. what is the linear sequence. This overlay is safe from aliasing. */
  269. +__SHMEM_DEFINE(const fde *, marker)
  270. +
  271. static inline void
  272. fde_split (struct object *ob, fde_compare_t fde_compare,
  273. struct fde_vector *linear, struct fde_vector *erratic)
  274. {
  275. - static const fde *marker;
  276. + #define marker __SHMEM_GET(marker)
  277. size_t count = linear->count;
  278. const fde *const *chain_end = &marker;
  279. size_t i, j, k;
  280. @@ -463,6 +469,7 @@
  281. erratic->array[k++] = linear->array[i];
  282. linear->count = j;
  283. erratic->count = k;
  284. + #undef marker
  285. }
  286. #define SWAP(x,y) do { const fde * tmp = x; x = y; y = tmp; } while (0)
  287. diff -r 0128c92731b8 gcc/unwind-dw2.c
  288. --- a/gcc/unwind-dw2.c Mon Dec 20 17:17:01 2010 -0700
  289. +++ b/gcc/unwind-dw2.c Tue Dec 21 20:56:42 2010 -0700
  290. @@ -36,6 +36,7 @@
  291. #include "unwind-dw2-fde.h"
  292. #include "gthr.h"
  293. #include "unwind-dw2.h"
  294. +#include "shmem.h"
  295. #ifndef __USING_SJLJ_EXCEPTIONS__
  296. @@ -78,7 +79,8 @@
  297. };
  298. /* Byte size of every register managed by these routines. */
  299. -static unsigned char dwarf_reg_size_table[DWARF_FRAME_REGISTERS+1];
  300. +__SHMEM_DEFINE_ARRAY(unsigned char, dwarf_reg_size_table, DWARF_FRAME_REGISTERS+1)
  301. +#define dwarf_reg_size_table __SHMEM_GET_ARRAY(dwarf_reg_size_table)
  302. /* Read unaligned data from the instruction buffer. */
  303. @@ -160,7 +162,7 @@
  304. #endif
  305. index = DWARF_REG_TO_UNWIND_COLUMN (index);
  306. - gcc_assert (index < (int) sizeof(dwarf_reg_size_table));
  307. + gcc_assert (index < (int) (sizeof(unsigned char) * (DWARF_FRAME_REGISTERS + 1)));
  308. size = dwarf_reg_size_table[index];
  309. ptr = context->reg[index];
  310. @@ -200,7 +202,7 @@
  311. void *ptr;
  312. index = DWARF_REG_TO_UNWIND_COLUMN (index);
  313. - gcc_assert (index < (int) sizeof(dwarf_reg_size_table));
  314. + gcc_assert (index < (int) (sizeof(unsigned char) * (DWARF_FRAME_REGISTERS + 1)));
  315. size = dwarf_reg_size_table[index];
  316. if (_Unwind_IsExtendedContext (context) && context->by_value[index])
  317. @@ -249,7 +251,7 @@
  318. _Unwind_Word val)
  319. {
  320. index = DWARF_REG_TO_UNWIND_COLUMN (index);
  321. - gcc_assert (index < (int) sizeof(dwarf_reg_size_table));
  322. + gcc_assert (index < (int) (sizeof(unsigned char) * (DWARF_FRAME_REGISTERS + 1)));
  323. gcc_assert (dwarf_reg_size_table[index] == sizeof (_Unwind_Ptr));
  324. context->by_value[index] = 1;
  325. @@ -1431,6 +1433,8 @@
  326. __builtin_init_dwarf_reg_size_table (dwarf_reg_size_table);
  327. }
  328. +__SHMEM_DEFINE_INIT(__gthread_once_t, once_regsizes, __GTHREAD_ONCE_INIT)
  329. +
  330. static void __attribute__((noinline))
  331. uw_init_context_1 (struct _Unwind_Context *context,
  332. void *outer_cfa, void *outer_ra)
  333. @@ -1449,8 +1453,7 @@
  334. #if __GTHREADS
  335. {
  336. - static __gthread_once_t once_regsizes = __GTHREAD_ONCE_INIT;
  337. - if (__gthread_once (&once_regsizes, init_dwarf_reg_size_table) != 0
  338. + if (__gthread_once (&__SHMEM_GET(once_regsizes), init_dwarf_reg_size_table) != 0
  339. && dwarf_reg_size_table[0] == 0)
  340. init_dwarf_reg_size_table ();
  341. }
  342. diff -r 0128c92731b8 gcc/unwind-sjlj.c
  343. --- a/gcc/unwind-sjlj.c Mon Dec 20 17:17:01 2010 -0700
  344. +++ b/gcc/unwind-sjlj.c Tue Dec 21 20:56:42 2010 -0700
  345. @@ -29,6 +29,7 @@
  346. #include "tm.h"
  347. #include "unwind.h"
  348. #include "gthr.h"
  349. +#include "shmem.h"
  350. #ifdef __USING_SJLJ_EXCEPTIONS__
  351. @@ -95,11 +96,14 @@
  352. /* Manage the chain of registered function contexts. */
  353. /* Single threaded fallback chain. */
  354. -static struct SjLj_Function_Context *fc_static;
  355. +__SHMEM_DEFINE(struct SjLj_Function_Context *, fc_static)
  356. +#define fc_static __SHMEM_GET(fc_static)
  357. #if __GTHREADS
  358. -static __gthread_key_t fc_key;
  359. -static int use_fc_key = -1;
  360. +__SHMEM_DEFINE(__gthread_key_t, fc_key)
  361. +#define fc_key __SHMEM_GET(fc_key)
  362. +__SHMEM_DEFINE_INIT(int, use_fc_key, -1)
  363. +#define use_fc_key __SHMEM_GET(use_fc_key)
  364. static void
  365. fc_key_init (void)
  366. @@ -107,11 +111,12 @@
  367. use_fc_key = __gthread_key_create (&fc_key, 0) == 0;
  368. }
  369. +__SHMEM_DEFINE_INIT(__gthread_once_t, sjlj_once, __GTHREAD_ONCE_INIT)
  370. +
  371. static void
  372. fc_key_init_once (void)
  373. {
  374. - static __gthread_once_t once = __GTHREAD_ONCE_INIT;
  375. - if (__gthread_once (&once, fc_key_init) != 0 || use_fc_key < 0)
  376. + if (__gthread_once (&__SHMEM_GET(sjlj_once), fc_key_init) != 0 || use_fc_key < 0)
  377. use_fc_key = 0;
  378. }
  379. #endif
  380. diff -r 0128c92731b8 libgcc/Makefile.in
  381. --- a/libgcc/Makefile.in Mon Dec 20 17:17:01 2010 -0700
  382. +++ b/libgcc/Makefile.in Tue Dec 21 20:56:42 2010 -0700
  383. @@ -719,6 +719,11 @@
  384. endif
  385. +libgcc-objects += shmem-win32.o
  386. +shmem-win32.o: $(srcdir)/../gcc/config/i386/shmem-win32.c
  387. + $(filter-out -fexceptions,$(gcc_compile)) \
  388. + -fno-exceptions -c $(srcdir)/../gcc/config/i386/shmem-win32.c
  389. +
  390. # Build LIBUNWIND.
  391. c_flags := -fexceptions
  392. diff -r 0128c92731b8 libstdc++-v3/libsupc++/eh_globals.cc
  393. --- a/libstdc++-v3/libsupc++/eh_globals.cc Mon Dec 20 17:17:01 2010 -0700
  394. +++ b/libstdc++-v3/libsupc++/eh_globals.cc Tue Dec 21 20:56:42 2010 -0700
  395. @@ -29,6 +29,7 @@
  396. #include "cxxabi.h"
  397. #include "unwind-cxx.h"
  398. #include "bits/gthr.h"
  399. +#include "shmem.h"
  400. #if _GLIBCXX_HOSTED
  401. using std::free;
  402. @@ -42,7 +43,7 @@
  403. using namespace __cxxabiv1;
  404. -#if _GLIBCXX_HAVE_TLS
  405. +#if _GLIBCXX_HAVE_TLS && !defined(__MINGW32__)
  406. namespace
  407. {
  408. @@ -66,7 +67,8 @@
  409. #else
  410. // Single-threaded fallback buffer.
  411. -static __cxa_eh_globals eh_globals;
  412. +__SHMEM_DEFINE_INIT(__cxa_eh_globals, eh_globals, __cxa_eh_globals())
  413. +#define eh_globals __SHMEM_GET(eh_globals)
  414. #if __GTHREADS
  415. @@ -105,9 +107,18 @@
  416. __gthread_key_delete(_M_key);
  417. _M_init = false;
  418. }
  419. +
  420. + __eh_globals_init& operator = (__eh_globals_init& c)
  421. + {
  422. + _M_key = c._M_key;
  423. + _M_init = c._M_init;
  424. + c._M_init = false;
  425. + return *this;
  426. + }
  427. };
  428. -static __eh_globals_init init;
  429. +__SHMEM_DEFINE_INIT(__eh_globals_init, init, __eh_globals_init())
  430. +#define init __SHMEM_GET(init)
  431. extern "C" __cxa_eh_globals*
  432. __cxxabiv1::__cxa_get_globals_fast() throw()
  433. diff -r 0128c92731b8 libstdc++-v3/libsupc++/eh_term_handler.cc
  434. --- a/libstdc++-v3/libsupc++/eh_term_handler.cc Mon Dec 20 17:17:01 2010 -0700
  435. +++ b/libstdc++-v3/libsupc++/eh_term_handler.cc Tue Dec 21 20:56:42 2010 -0700
  436. @@ -24,6 +24,7 @@
  437. #include <bits/c++config.h>
  438. #include "unwind-cxx.h"
  439. +#include "shmem.h"
  440. /* We default to the talkative, informative handler in a normal hosted
  441. library. This pulls in the demangler, the dyn-string utilities, and
  442. @@ -37,10 +38,11 @@
  443. #endif
  444. /* The current installed user handler. */
  445. -std::terminate_handler __cxxabiv1::__terminate_handler =
  446. +namespace __cxxabiv1
  447. +{
  448. #if _GLIBCXX_HOSTED
  449. - __gnu_cxx::__verbose_terminate_handler;
  450. + __SHMEM_DEFINE_INIT(std::terminate_handler, __terminate_handler_sh, __gnu_cxx::__verbose_terminate_handler)
  451. #else
  452. - std::abort;
  453. + __SHMEM_DEFINE_INIT(std::terminate_handler, __terminate_handler_sh, std::abort)
  454. #endif
  455. -
  456. +}
  457. diff -r 0128c92731b8 libstdc++-v3/libsupc++/eh_unex_handler.cc
  458. --- a/libstdc++-v3/libsupc++/eh_unex_handler.cc Mon Dec 20 17:17:01 2010 -0700
  459. +++ b/libstdc++-v3/libsupc++/eh_unex_handler.cc Tue Dec 21 20:56:42 2010 -0700
  460. @@ -23,7 +23,11 @@
  461. // <http://www.gnu.org/licenses/>.
  462. #include "unwind-cxx.h"
  463. +#include "shmem.h"
  464. /* The current installed user handler. */
  465. -std::unexpected_handler __cxxabiv1::__unexpected_handler = std::terminate;
  466. +namespace __cxxabiv1
  467. +{
  468. + __SHMEM_DEFINE_INIT(std::unexpected_handler, __unexpected_handler_sh, std::terminate)
  469. +}
  470. diff -r 0128c92731b8 libstdc++-v3/libsupc++/unwind-cxx.h
  471. --- a/libstdc++-v3/libsupc++/unwind-cxx.h Mon Dec 20 17:17:01 2010 -0700
  472. +++ b/libstdc++-v3/libsupc++/unwind-cxx.h Tue Dec 21 20:56:42 2010 -0700
  473. @@ -36,6 +36,7 @@
  474. #include <cstddef>
  475. #include "unwind.h"
  476. #include <bits/atomic_word.h>
  477. +#include "shmem.h"
  478. #pragma GCC visibility push(default)
  479. @@ -208,8 +209,10 @@
  480. extern void __unexpected(std::unexpected_handler) __attribute__((noreturn));
  481. // The current installed user handlers.
  482. -extern std::terminate_handler __terminate_handler;
  483. -extern std::unexpected_handler __unexpected_handler;
  484. +__SHMEM_DECLARE(std::terminate_handler, __terminate_handler_sh)
  485. +#define __terminate_handler __SHMEM_GET(__terminate_handler_sh)
  486. +__SHMEM_DECLARE(std::unexpected_handler, __unexpected_handler_sh)
  487. +#define __unexpected_handler __SHMEM_GET(__unexpected_handler_sh)
  488. // These are explicitly GNU C++ specific.
  489. diff -r 0128c92731b8 libstdc++-v3/src/Makefile.in
  490. --- a/libstdc++-v3/src/Makefile.in Mon Dec 20 17:17:01 2010 -0700
  491. +++ b/libstdc++-v3/src/Makefile.in Tue Dec 21 20:56:42 2010 -0700
  492. @@ -444,12 +444,36 @@
  493. libstdc___la_SOURCES = $(sources)
  494. libstdc___la_LIBADD = \
  495. - $(GLIBCXX_LIBS) \
  496. + $(GLIBCXX_LIBS)
  497. +libstdc___la_LIBADD_STATIC = \
  498. $(top_builddir)/libsupc++/libsupc++convenience.la
  499. +libstdc___la_LIBADD_SHARED = \
  500. + $(top_builddir)/libsupc++/convenience-shared/libsupc++convenience.la
  501. libstdc___la_DEPENDENCIES = \
  502. - ${version_dep} \
  503. + ${version_dep}
  504. +libstdc___la_DEPENDENCIES_STATIC = \
  505. $(top_builddir)/libsupc++/libsupc++convenience.la
  506. +libstdc___la_DEPENDENCIES_SHARED = \
  507. + $(top_builddir)/libsupc++/convenience-shared/libsupc++convenience.la
  508. +
  509. +$(top_builddir)/libsupc++/convenience-shared/libsupc++convenience.la: $(top_builddir)/libsupc++/libsupc++convenience.la
  510. + cp $(top_builddir)/libsupc++/libsupc++.la $(top_builddir)/libsupc++/libsupc++_noshared.la
  511. + cp $(top_builddir)/libsupc++/.libs/libsupc++.a $(top_builddir)/libsupc++/libsupc++_noshared.a
  512. + cp $(top_builddir)/libsupc++/libsupc++convenience.la $(top_builddir)/libsupc++/libsupc++convenience_noshared.la
  513. + cp $(top_builddir)/libsupc++/.libs/libsupc++convenience.a $(top_builddir)/libsupc++/libsupc++convenience_noshared.a
  514. + $(MAKE) -C $(top_builddir)/libsupc++ clean
  515. + $(MAKE) -C $(top_builddir)/libsupc++ CFLAGS="$(CFLAGS) -DSHARED" CXXFLAGS="$(CXXFLAGS) -DSHARED"
  516. + mkdir -p -- "$(top_builddir)/libsupc++/convenience-shared/.libs"
  517. + cp $(top_builddir)/libsupc++/libsupc++convenience.la $(top_builddir)/libsupc++/convenience-shared/
  518. + cp $(top_builddir)/libsupc++/libsupc++convenience.la $(top_builddir)/libsupc++/convenience-shared/.libs/
  519. + cp $(top_builddir)/libsupc++/.libs/libsupc++convenience.a $(top_builddir)/libsupc++/convenience-shared/.libs/
  520. + cp $(top_builddir)/libsupc++/libsupc++_noshared.la $(top_builddir)/libsupc++/libsupc++.la
  521. + cp $(top_builddir)/libsupc++/libsupc++_noshared.la $(top_builddir)/libsupc++/.libs/libsupc++.la
  522. + cp $(top_builddir)/libsupc++/libsupc++_noshared.a $(top_builddir)/libsupc++/.libs/libsupc++.a
  523. + cp $(top_builddir)/libsupc++/libsupc++convenience_noshared.la $(top_builddir)/libsupc++/libsupc++convenience.la
  524. + cp $(top_builddir)/libsupc++/libsupc++convenience_noshared.la $(top_builddir)/libsupc++/.libs/libsupc++convenience.la
  525. + cp $(top_builddir)/libsupc++/libsupc++convenience_noshared.a $(top_builddir)/libsupc++/.libs/libsupc++convenience.a
  526. libstdc___la_LDFLAGS = \
  527. -version-info $(libtool_VERSION) ${version_arg} -lm
  528. @@ -573,8 +597,13 @@
  529. echo "rm -f \"$${dir}/so_locations\""; \
  530. rm -f "$${dir}/so_locations"; \
  531. done
  532. -libstdc++.la: $(libstdc___la_OBJECTS) $(libstdc___la_DEPENDENCIES)
  533. - $(libstdc___la_LINK) -rpath $(toolexeclibdir) $(libstdc___la_OBJECTS) $(libstdc___la_LIBADD) $(LIBS)
  534. +libstdc++.la: $(libstdc___la_OBJECTS) $(libstdc___la_DEPENDENCIES) $(libstdc___la_DEPENDENCIES_STATIC) $(libstdc___la_DEPENDENCIES_SHARED)
  535. + $(LIBTOOL) --tag CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link \
  536. + $(CXX) $(OPT_LDFLAGS) $(SECTION_LDFLAGS) -static $(AM_CXXFLAGS) $(LTLDFLAGS) -o $@ \
  537. + $(libstdc___la_LDFLAGS) -rpath $(toolexeclibdir) $(libstdc___la_OBJECTS) $(libstdc___la_LIBADD) $(libstdc___la_LIBADD_STATIC) $(LIBS)
  538. + cp .libs/libstdc++.a libstdc++_noshared.a
  539. + $(libstdc___la_LINK) -rpath $(toolexeclibdir) $(libstdc___la_OBJECTS) $(libstdc___la_LIBADD) $(libstdc___la_LIBADD_SHARED) $(LIBS)
  540. + cp libstdc++_noshared.a .libs/libstdc++.a
  541. mostlyclean-compile:
  542. -rm -f *.$(OBJEXT)