From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 74229 invoked by alias); 7 Oct 2017 22:17:45 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 74220 invoked by uid 89); 7 Oct 2017 22:17:45 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-10.2 required=5.0 tests=AWL,BAYES_00,GIT_PATCH_2,GIT_PATCH_3,KAM_ASCII_DIVIDERS,RCVD_IN_DNSWL_NONE,SPF_PASS autolearn=ham version=3.3.2 spammy=restores X-HELO: smtp.eu.adacore.com Received: from mel.act-europe.fr (HELO smtp.eu.adacore.com) (194.98.77.210) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Sat, 07 Oct 2017 22:17:43 +0000 Received: from localhost (localhost [127.0.0.1]) by filtered-smtp.eu.adacore.com (Postfix) with ESMTP id 5ADCB823B2 for ; Sun, 8 Oct 2017 00:17:40 +0200 (CEST) Received: from smtp.eu.adacore.com ([127.0.0.1]) by localhost (smtp.eu.adacore.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id OqvRocDDR6i5 for ; Sun, 8 Oct 2017 00:17:40 +0200 (CEST) Received: from polaris.localnet (bon31-6-88-161-99-133.fbx.proxad.net [88.161.99.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.eu.adacore.com (Postfix) with ESMTPSA id 341D4823AA for ; Sun, 8 Oct 2017 00:17:40 +0200 (CEST) From: Eric Botcazou To: gcc-patches@gcc.gnu.org Subject: Restore functional DONT_USE_BUILTIN_SETJMP support Date: Sun, 08 Oct 2017 10:57:00 -0000 Message-ID: <2067154.q9SCchci8G@polaris> User-Agent: KMail/4.14.10 (Linux/3.16.7-53-desktop; KDE/4.14.9; x86_64; ; ) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="nextPart23929419.gEYTcozdSh" Content-Transfer-Encoding: 7Bit X-SW-Source: 2017-10/txt/msg00427.txt.bz2 This is a multi-part message in MIME format. --nextPart23929419.gEYTcozdSh Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" Content-length: 963 DONT_USE_BUILTIN_SETJMP is an old configuration macro that instructs the compiler to use the usual setjmp/longjmp routines instead of their built-in variants to implement SJLJ exceptions. It's less efficient but, sometimes, the setjmp/longjmp routines have specific features that cannot be easily implemented by the built-in. Only IA-64 and Aarch64 define it. The support is currently broken at compile time (because of a broken CFG) and at link time (an unresolved symbol). The attached small patch restores it. Bootstrapped & tested on Aarch64/Linux with --enable-sjlj-exceptions, applied on the mainline as obvious. 2017-10-07 Eric Botcazou * builtins.def (BUILT_IN_SETJMP): Declare as library builtin instead of GCC builtin if DONT_USE_BUILTIN_SETJMP is defined. * except.c (sjlj_emit_function_enter): If DONT_USE_BUILTIN_SETJMP is defined, force the creation of a new block for a dispatch label. -- Eric Botcazou --nextPart23929419.gEYTcozdSh Content-Disposition: attachment; filename="p.diff" Content-Transfer-Encoding: 7Bit Content-Type: text/x-patch; charset="UTF-8"; name="p.diff" Content-length: 2096 Index: builtins.def =================================================================== --- builtins.def (revision 253506) +++ builtins.def (working copy) @@ -890,7 +890,11 @@ DEF_LIB_BUILTIN (BUILT_IN_REALLOC DEF_GCC_BUILTIN (BUILT_IN_RETURN, "return", BT_FN_VOID_PTR, ATTR_NORETURN_NOTHROW_LEAF_LIST) DEF_GCC_BUILTIN (BUILT_IN_RETURN_ADDRESS, "return_address", BT_FN_PTR_UINT, ATTR_LEAF_LIST) DEF_GCC_BUILTIN (BUILT_IN_SAVEREGS, "saveregs", BT_FN_PTR_VAR, ATTR_NULL) +#ifdef DONT_USE_BUILTIN_SETJMP +DEF_LIB_BUILTIN (BUILT_IN_SETJMP, "setjmp", BT_FN_INT_PTR, ATTR_RT_NOTHROW_LEAF_LIST) +#else DEF_GCC_BUILTIN (BUILT_IN_SETJMP, "setjmp", BT_FN_INT_PTR, ATTR_RT_NOTHROW_LEAF_LIST) +#endif DEF_EXT_LIB_BUILTIN (BUILT_IN_STRFMON, "strfmon", BT_FN_SSIZE_STRING_SIZE_CONST_STRING_VAR, ATTR_FORMAT_STRFMON_NOTHROW_3_4) DEF_LIB_BUILTIN (BUILT_IN_STRFTIME, "strftime", BT_FN_SIZE_STRING_SIZE_CONST_STRING_CONST_TM_PTR, ATTR_FORMAT_STRFTIME_NOTHROW_3_0) DEF_GCC_BUILTIN (BUILT_IN_TRAP, "trap", BT_FN_VOID, ATTR_NORETURN_NOTHROW_LEAF_COLD_LIST) Index: except.c =================================================================== --- except.c (revision 253506) +++ except.c (working copy) @@ -1209,6 +1209,28 @@ sjlj_emit_function_enter (rtx_code_label fn_begin_outside_block = false; } +#ifdef DONT_USE_BUILTIN_SETJMP + if (dispatch_label) + { + /* The sequence contains a branch in the middle so we need to force + the creation of a new basic block by means of BB_SUPERBLOCK. */ + if (fn_begin_outside_block) + { + basic_block bb + = split_edge (single_succ_edge (ENTRY_BLOCK_PTR_FOR_FN (cfun))); + if (JUMP_P (BB_END (bb))) + emit_insn_before (seq, BB_END (bb)); + else + emit_insn_after (seq, BB_END (bb)); + } + else + emit_insn_after (seq, fn_begin); + + single_succ (ENTRY_BLOCK_PTR_FOR_FN (cfun))->flags |= BB_SUPERBLOCK; + return; + } +#endif + if (fn_begin_outside_block) insert_insn_on_edge (seq, single_succ_edge (ENTRY_BLOCK_PTR_FOR_FN (cfun))); else --nextPart23929419.gEYTcozdSh--