... just to keep you updated, I'm finishing testing the below, appears to work well. Still missing: comments about ABI (no throw()) vs our specific libsupc++ implementation (suggestions very welcome ;)
Paolo. //////////////////
Index: except.c =================================================================== *** except.c (revision 138089) --- except.c (working copy) *************** do_get_exception_ptr (void) *** 171,179 **** fn = get_identifier ("__cxa_get_exception_ptr"); if (!get_global_value_if_present (fn, &fn)) { ! /* Declare void* __cxa_get_exception_ptr (void *). */ ! tree tmp = tree_cons (NULL_TREE, ptr_type_node, void_list_node); ! fn = push_library_fn (fn, build_function_type (ptr_type_node, tmp)); } return cp_build_function_call (fn, tree_cons (NULL_TREE, build_exc_ptr (), --- 171,181 ---- fn = get_identifier ("__cxa_get_exception_ptr"); if (!get_global_value_if_present (fn, &fn)) { ! /* Declare void* __cxa_get_exception_ptr (void *) throw(). */ ! tree args = tree_cons (NULL_TREE, ptr_type_node, void_list_node); ! tree tmp = build_function_type (ptr_type_node, args); ! fn = push_library_fn (fn, build_exception_variant (tmp, ! empty_except_spec)); } return cp_build_function_call (fn, tree_cons (NULL_TREE, build_exc_ptr (), *************** do_begin_catch (void) *** 192,200 **** fn = get_identifier ("__cxa_begin_catch"); if (!get_global_value_if_present (fn, &fn)) { ! /* Declare void* __cxa_begin_catch (void *). */ ! tree tmp = tree_cons (NULL_TREE, ptr_type_node, void_list_node); ! fn = push_library_fn (fn, build_function_type (ptr_type_node, tmp)); } return cp_build_function_call (fn, tree_cons (NULL_TREE, build_exc_ptr (), --- 194,204 ---- fn = get_identifier ("__cxa_begin_catch"); if (!get_global_value_if_present (fn, &fn)) { ! /* Declare void* __cxa_begin_catch (void *) throw(). */ ! tree args = tree_cons (NULL_TREE, ptr_type_node, void_list_node); ! tree tmp = build_function_type (ptr_type_node, args); ! fn = push_library_fn (fn, build_exception_variant (tmp, ! empty_except_spec)); } return cp_build_function_call (fn, tree_cons (NULL_TREE, build_exc_ptr (), *************** do_allocate_exception (tree type) *** 543,551 **** fn = get_identifier ("__cxa_allocate_exception"); if (!get_global_value_if_present (fn, &fn)) { ! /* Declare void *__cxa_allocate_exception(size_t). */ ! tree tmp = tree_cons (NULL_TREE, size_type_node, void_list_node); ! fn = push_library_fn (fn, build_function_type (ptr_type_node, tmp)); } return cp_build_function_call (fn, --- 547,557 ---- fn = get_identifier ("__cxa_allocate_exception"); if (!get_global_value_if_present (fn, &fn)) { ! /* Declare void *__cxa_allocate_exception(size_t) throw(). */ ! tree args = tree_cons (NULL_TREE, size_type_node, void_list_node); ! tree tmp = build_function_type (ptr_type_node, args); ! fn = push_library_fn (fn, build_exception_variant (tmp, ! empty_except_spec)); } return cp_build_function_call (fn, *************** do_free_exception (tree ptr) *** 565,573 **** fn = get_identifier ("__cxa_free_exception"); if (!get_global_value_if_present (fn, &fn)) { ! /* Declare void __cxa_free_exception (void *). */ ! fn = push_void_library_fn (fn, tree_cons (NULL_TREE, ptr_type_node, ! void_list_node)); } return cp_build_function_call (fn, tree_cons (NULL_TREE, ptr, NULL_TREE), --- 571,581 ---- fn = get_identifier ("__cxa_free_exception"); if (!get_global_value_if_present (fn, &fn)) { ! /* Declare void __cxa_free_exception (void *) throw(). */ ! tree args = tree_cons (NULL_TREE, ptr_type_node, void_list_node); ! tree tmp = build_function_type (void_type_node, args); ! fn = push_library_fn (fn, build_exception_variant (tmp, ! empty_except_spec)); } return cp_build_function_call (fn, tree_cons (NULL_TREE, ptr, NULL_TREE),