Commit Graph

21 Commits

Author SHA1 Message Date
Jakub Jelinek 7adcbafe45 Update copyright years. 2022-01-03 10:42:10 +01:00
Iain Sandoe caa04517e6 libitm: Fix bootstrap for targets without HAVE_ELF_STYLE_WEAKREF.
Recent improvements to null address warnings notice that for
targets that do not support HAVE_ELF_STYLE_WEAKREF the dummy stub
implementation of __cxa_get_globals() means that the address can
never be null.

Fixed by removing the test for such targets.

Signed-off-by: Iain Sandoe <iain@sandoe.co.uk>

libitm/ChangeLog:

	* eh_cpp.cc (GTM::gtm_thread::init_cpp_exceptions): If the
	target does not support HAVE_ELF_STYLE_WEAKREF then do not
	try to test the __cxa_get_globals against NULL.
2021-11-26 19:40:27 +00:00
Jakub Jelinek 99dee82307 Update copyright years. 2021-01-04 10:26:59 +01:00
Nathan Sidwell f0de5d83ee Fix throw specifiers on interface.
I discovered that libitm:
(a) declares __cxa_allocate_exception and friends directly,
(b) doesn't mark them as 'throw()'
(c) doesn't mark the replacment fns _ITM_$foo as nothrow either

We happen to get away with it because of code in the compiler that,
although it checks the parameter types, doesn't check the exception
specification.  (One reason being they used to not be part of the
language's type system, but now they are.)  I suspect this can lead us
to generate pessimal code later, if we've seen one of these decls
earlier.  Anyway, with modules it becomes trickier[*], so I'm trying
to clean it up and not be a problem.  I see Jakub fixed part of the
problem
(https://gcc.gnu.org/pipermail/gcc-patches/2018-December/513302.html)
AFAICT, he did fix libitm's decls, but left the lax parm-type checking
in the compiler.

libitm.h is not very informative about specification:
  in version 1 of http://www.intel.com/some/path/here.pdf.  */

Anyway, it was too fiddly to have libitm pick up the declarations from
libsupc++.  Besides it makes them weak declarations, and then provides
definitions for non-elf systems.  So this patch adds the expected
'throw()'

	* libitm/libitm.h (_ITM_NOTHROW): Define.
	(_ITM_cxa_allocate_exception, _ITM_cxa_free_exception)
	(_ITM_cxa_begin_catch): Use it.
	* eh_cpp.cc: Add throw() to __cxa_allocate_exception,
	__cxa_free_exception, __cxa_begin_catch, __cxa_tm_cleanup,
	__cxa_get_globals.
	(_ITM_cxa_allocate_exception, _ITM_cxa_free_exception)
	(_ITM_cxa_begin_catch): Likewise.
2020-05-12 10:54:53 -07:00
Jakub Jelinek 8d9254fc8a Update copyright years.
From-SVN: r279813
2020-01-01 12:51:42 +01:00
Jakub Jelinek a554497024 Update copyright years.
From-SVN: r267494
2019-01-01 13:31:55 +01:00
Jakub Jelinek 784417d1f8 re PR c++/88482 (ICE when wrongly declaring __cxa_allocate_exception)
PR c++/88482
	* except.c (verify_library_fn): New function.
	(declare_library_fn): Use it.  Initialize TM even if the non-TM
	library function has been user declared.
	(do_end_catch): Don't set TREE_NOTHROW on error_mark_node.
	(expand_start_catch_block): Don't call initialize_handler_parm
	for error_mark_node.
	(build_throw): Use verify_library_fn.  Initialize TM even if the
	non-TM library function has been user declared.  Don't crash if
	any library fn is error_mark_node.

	* g++.dg/eh/builtin5.C: New test.
	* g++.dg/eh/builtin6.C: New test.
	* g++.dg/eh/builtin7.C: New test.
	* g++.dg/eh/builtin8.C: New test.
	* g++.dg/eh/builtin9.C: New test.
	* g++.dg/eh/builtin10.C: New test.
	* g++.dg/eh/builtin11.C: New test.
	* g++.dg/parse/crash55.C: Adjust expected diagnostics.

	* eh_cpp.cc (__cxa_throw): Change DEST argument type from
	void * to void (*) (void *).
	(_ITM_cxa_throw): Likewise.
	* libitm.h (_ITM_cxa_throw): Likewise.
	* libitm.texi (_ITM_cxa_throw): Likewise.

From-SVN: r267179
2018-12-16 00:51:31 +01:00
Jakub Jelinek 85ec4feb11 Update copyright years.
From-SVN: r256169
2018-01-03 11:03:58 +01:00
Jakub Jelinek cbe34bb5ed Update copyright years.
From-SVN: r243994
2017-01-01 13:07:43 +01:00
Jakub Jelinek 818ab71a41 Update copyright years.
From-SVN: r232055
2016-01-04 15:30:50 +01:00
Torvald Riegel 258c1d0722 Support __cxa_free_exception and fix exception handling.
gcc/cp/
	* except.c (do_free_exception): Use transactional wrapper.

	libitm/
	* testsuite/libitm.c++/eh-5.C: New.
	* libitm.h (_ITM_cxa_free_exception): New.
	* libitm.map (_ITM_cxa_free_exception): Add it.
	* libitm.texi: Update ABI docs.
	* libitm_i.h (gtm_transaction_cp::cxa_unthrown): Remove.
	(gtm_transaction_cp::cxa_uncaught_count): Add.
	(gtm_thread::cxa_unthrown): Remove.
	(gtm_thread::cxa_uncaught_count_ptr): Add.
	(gtm_thread::cxa_uncaught_count): Add.
	(gtm_thread::drop_references_allocations): Rename to...
	(gtm_thread::discard_allocation): ... this and adapt.
	(gtm_thread::init_cpp_exceptions): New.
	* beginend.cc (gtm_thread::gtm_thread): Adapt EH handling.
	(gtm_thread::begin_transaction): Likewise.
	(gtm_transaction_cp::save): Likewise.
	(gtm_thread::trycommit): Likewise.
	* eh_cpp.cc: Add overview comments.
	(__cxa_eh_globals, __cxa_get_globals, __cxa_free_exception): Declare.
	(free_any_exception, _ITM_cxa_free_exception): New.
	(gtm_thread::init_cpp_exceptions): Define.
	(_ITM_cxa_allocate_exception, _ITM_cxa_throw): Adapt.
	(_ITM_cxa_begin_catch, _ITM_cxa_end_catch): Likewise.
	(gtm_thread::revert_cpp_exceptions): Likewise.

From-SVN: r230634
2015-11-20 00:10:08 +00:00
Jakub Jelinek 5624e564d2 Update copyright years.
From-SVN: r219188
2015-01-05 13:33:28 +01:00
Richard Sandiford f93608e6d4 Update copyright years in libitm/
From-SVN: r206298
2014-01-02 22:26:00 +00:00
Iain Sandoe 6c59ffd1ac re PR libitm/55693 (libitm.c++/eh-1.C execution test fails on darwin from r193271)
/libgcc
2013-02-11  Iain Sandoe  <iain@codesourcery.com>
	    Jack Howarth  <howarth@bromo.med.uc.edu>
	    Patrick Marlier  <patrick.marlier@gmail.com>

	PR libitm/55693
	* config/darwin-crt-tm.c: Remove dummy functions hack.

/gcc
2013-02-11  Iain Sandoe  <iain@codesourcery.com>
	    Jack Howarth  <howarth@bromo.med.uc.edu>
	    Patrick Marlier  <patrick.marlier@gmail.com>

	PR libitm/55693
	* config/darwin.h: Replace ENDFILE_SPEC with TM_DESTRUCTOR and
	define ENDFILE_SPEC as TM_DESTRUCTOR.
	* config/i386/darwin.h (ENDFILE_SPEC): Use TM_DESTRUCTOR.

/libitm
2013-02-11  Iain Sandoe  <iain@codesourcery.com>
	    Jack Howarth  <howarth@bromo.med.uc.edu>
	    Patrick Marlier  <patrick.marlier@gmail.com>

	PR libitm/55693
	* alloc_cpp.cc: Enable function declarations on darwin.
	* eh_cpp.cc: Likewise.

Co-Authored-By: Jack Howarth <howarth@bromo.med.uc.edu>
Co-Authored-By: Patrick Marlier <patrick.marlier@gmail.com>

From-SVN: r195960
2013-02-11 23:30:10 +00:00
Richard Sandiford 75f9527c9b Update copyright in libitm.
From-SVN: r195697
2013-02-03 17:46:11 +00:00
Patrick Marlier f2f9a0977a eh_cpp.cc: Fix __cxa_end_catch declaration.
2012-05-21  Patrick Marlier  <patrick.marlier@gmail.com>

	* eh_cpp.cc: Fix __cxa_end_catch declaration.

From-SVN: r187747
2012-05-21 22:48:00 +00:00
Iain Sandoe e948a1fbd4 re PR libitm/52220 (FAIL: libitm.c++/eh-1.C execution test due to Xcode 4 weakref linker bug)
libitm/
2012-02-15  Iain Sandoe  <iains@gcc.gnu.org>
	    Patrick Marlier  <patrick.marlier@gmail.com>

	PR libitm/52220
	* alloc_cpp.cc: No dummy definitions for darwin.
	* eh_cpp.cc: Likewise.

libgcc/
2012-02-15  Iain Sandoe  <iains@gcc.gnu.org>
	    Patrick Marlier  <patrick.marlier@gmail.com>

	PR libitm/52220
	* config/darwin-crt-tm.c: Generate dummy functions.


Co-Authored-By: Patrick Marlier <patrick.marlier@gmail.com>

From-SVN: r184293
2012-02-15 23:39:28 +00:00
Richard Henderson 8377e5e546 libitm_i.h (_Unwind_DeleteException): Declare weak.
* libitm_i.h (_Unwind_DeleteException): Declare weak.
	* eh_cpp.cc (_Unwind_DeleteException): Define for
	!HAVE_ELF_STYLE_WEAKREF.

From-SVN: r183049
2012-01-09 19:16:07 -08:00
Iain Sandoe 8cf36bb3b8 weakref.m4: New file.
config:

	* weakref.m4: New file.

libitm:

	* configure.ac: Use GCC_CHECK_ELF_STYLE_WEAKREF.
	* alloc_cpp.cc: Generate dummy functions if we don't
	HAVE_ELF_STYLE_WEAKREF.
	* eh_cpp.cc: Likewise.
	* configure: Regenerate.
	* aclocal.m4:  Likewise.
	* config.h.in: Likewise.
	* Makefile.in: Likewise.
	* testsuite/Makefile.in: Likewise.

From-SVN: r181618
2011-11-22 14:49:11 +00:00
Rainer Orth d846e425c9 Provide all dummy functions in alloc_cpp.cc, eh_cpp.cc
* alloc_cpp.cc [__osf__] (_ZnwX, _ZdlPv, _ZnaX, _ZdaPv,
	_ZnwXRKSt9nothrow_t, _ZdlPvRKSt9nothrow_t, _ZdaPvRKSt9nothrow_t):
	Dummy functions.
	* eh_cpp.cc [__osf__] (__cxa_allocate_exception, __cxa_throw,
	__cxa_begin_catch, __cxa_end_catch, __cxa_tm_cleanup): Likewise.

From-SVN: r181442
2011-11-17 11:34:33 +00:00
Aldy Hernandez 0a35513e4e Merge from transactional-memory branch.
From-SVN: r181154
2011-11-08 11:13:41 +00:00