diff options
author | Eric Botcazou <ebotcazou@adacore.com> | 2017-10-09 22:32:01 +0000 |
---|---|---|
committer | Eric Botcazou <ebotcazou@gcc.gnu.org> | 2017-10-09 22:32:01 +0000 |
commit | 2ab71f3d8707c9b292e5853050b5fbba2911fccb (patch) | |
tree | df251f986249456032810cbe349db8303fe1659b /gcc | |
parent | 3fc40cd783cb149d7d6c328def33606ec17ab15f (diff) | |
download | gcc-2ab71f3d8707c9b292e5853050b5fbba2911fccb.zip gcc-2ab71f3d8707c9b292e5853050b5fbba2911fccb.tar.gz gcc-2ab71f3d8707c9b292e5853050b5fbba2911fccb.tar.bz2 |
except.c (setjmp_fn): New global variable.
* except.c (setjmp_fn): New global variable.
(init_eh): Initialize it if DONT_USE_BUILTIN_SETJMP is defined.
(sjlj_emit_function_enter): Call it instead of BUILTIN_SETJMP if
DONT_USE_BUILTIN_SETJMP is defined.
From-SVN: r253569
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 7 | ||||
-rw-r--r-- | gcc/except.c | 17 |
2 files changed, 21 insertions, 3 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 871166a..5ba4c6c 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +2017-10-09 Eric Botcazou <ebotcazou@adacore.com> + + * except.c (setjmp_fn): New global variable. + (init_eh): Initialize it if DONT_USE_BUILTIN_SETJMP is defined. + (sjlj_emit_function_enter): Call it instead of BUILTIN_SETJMP + if DONT_USE_BUILTIN_SETJMP is defined. + 2017-10-09 Segher Boessenkool <segher@kernel.crashing.org> * target.def (insn_cost): New hook. diff --git a/gcc/except.c b/gcc/except.c index 4991e7b..041f89a 100644 --- a/gcc/except.c +++ b/gcc/except.c @@ -147,7 +147,9 @@ along with GCC; see the file COPYING3. If not see static GTY(()) int call_site_base; -static GTY (()) hash_map<tree_hash, tree> *type_to_runtime_map; +static GTY(()) hash_map<tree_hash, tree> *type_to_runtime_map; + +static GTY(()) tree setjmp_fn; /* Describe the SjLj_Function_Context structure. */ static GTY(()) tree sjlj_fc_type_node; @@ -331,6 +333,16 @@ init_eh (void) sjlj_fc_jbuf_ofs = (tree_to_uhwi (DECL_FIELD_OFFSET (f_jbuf)) + tree_to_uhwi (DECL_FIELD_BIT_OFFSET (f_jbuf)) / BITS_PER_UNIT); + +#ifdef DONT_USE_BUILTIN_SETJMP + tmp = build_function_type_list (integer_type_node, TREE_TYPE (f_jbuf), + NULL); + setjmp_fn = build_decl (BUILTINS_LOCATION, FUNCTION_DECL, + get_identifier ("setjmp"), tmp); + TREE_PUBLIC (setjmp_fn) = 1; + DECL_EXTERNAL (setjmp_fn) = 1; + DECL_ASSEMBLER_NAME (setjmp_fn); +#endif } } @@ -1176,8 +1188,7 @@ sjlj_emit_function_enter (rtx_code_label *dispatch_label) addr = convert_memory_address (ptr_mode, addr); tree addr_tree = make_tree (ptr_type_node, addr); - tree fn = builtin_decl_implicit (BUILT_IN_SETJMP); - tree call_expr = build_call_expr (fn, 1, addr_tree); + tree call_expr = build_call_expr (setjmp_fn, 1, addr_tree); rtx x = expand_call (call_expr, NULL_RTX, false); emit_cmp_and_jump_insns (x, const0_rtx, NE, 0, |