From: Eric Botcazou <ebotcazou@adacore.com>
To: Andreas Schwab <schwab@linux-m68k.org>
Cc: gcc-patches@gcc.gnu.org
Subject: Re: Restore functional DONT_USE_BUILTIN_SETJMP support
Date: Mon, 09 Oct 2017 22:56:00 -0000 [thread overview]
Message-ID: <2413676.eSlVKtS20K@polaris> (raw)
In-Reply-To: <3741644.vybPHbpigD@polaris>
[-- Attachment #1: Type: text/plain, Size: 635 bytes --]
> You're right, not clear why I didn't spot it on Aarch64. Hunk reverted.
The attached patch replaces it with an ad-hoc definition of setjmp, like the
ones used for the coverage routines. Tested on Aarch64/Linux with and without
--enable-sjlj-exceptions and on IA-64/Linux without --enable-sjlj-exceptions.
Applied on the mainline as obvious.
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.
--
Eric Botcazou
[-- Attachment #2: p.diff --]
[-- Type: text/x-patch, Size: 1526 bytes --]
Index: except.c
===================================================================
--- except.c (revision 253530)
+++ except.c (working copy)
@@ -147,7 +147,9 @@ along with GCC; see the file COPYING3.
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
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,
next prev parent reply other threads:[~2017-10-09 22:33 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-10-08 10:57 Eric Botcazou
2017-10-08 14:18 ` Andreas Schwab
2017-10-09 2:13 ` Joseph Myers
2017-10-08 16:38 ` Andreas Schwab
2017-10-08 20:52 ` Eric Botcazou
2017-10-09 22:56 ` Eric Botcazou [this message]
2017-10-10 8:44 Dominique d'Humières
2017-10-10 10:34 ` Eric Botcazou
2017-10-10 10:57 ` Dominique d'Humières
2017-10-10 11:59 ` Eric Botcazou
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=2413676.eSlVKtS20K@polaris \
--to=ebotcazou@adacore.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=schwab@linux-m68k.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).