From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Andrea Corallo via "Bug reports for GNU Emacs, the Swiss army knife of text editors" Newsgroups: gmane.emacs.bugs Subject: bug#46495: 28.0.50; [native-comp] Build fails for 32bit --with-wide-int Date: Wed, 17 Feb 2021 18:03:08 +0000 Message-ID: References: <86y2fq93zj.fsf@gmail.com> <83lfbqbq3g.fsf@gnu.org> <868s7pwvq8.fsf@gmail.com> <28FB9567-61E6-4083-8711-6CF6C8A493F4@gnu.org> <86o8gjheaw.fsf@gmail.com> Reply-To: Andrea Corallo Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="39802"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) Cc: andrewjmoreton@gmail.com To: 46495@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Wed Feb 17 19:04:39 2021 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lCRBm-000ABm-EQ for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 17 Feb 2021 19:04:38 +0100 Original-Received: from localhost ([::1]:59804 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lCRBl-0007ac-Da for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 17 Feb 2021 13:04:37 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:54868) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lCRBE-0007Ud-Ep for bug-gnu-emacs@gnu.org; Wed, 17 Feb 2021 13:04:04 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:33301) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lCRBC-0001D8-Dn for bug-gnu-emacs@gnu.org; Wed, 17 Feb 2021 13:04:04 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1lCRBC-0000A4-9L for bug-gnu-emacs@gnu.org; Wed, 17 Feb 2021 13:04:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Andrea Corallo Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 17 Feb 2021 18:04:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 46495 X-GNU-PR-Package: emacs X-Debbugs-Original-To: Andrea Corallo via "Bug reports for GNU Emacs, the Swiss army knife of text editors" X-Debbugs-Original-Cc: Andy Moreton , 46495@debbugs.gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.1613585011572 (code B ref -1); Wed, 17 Feb 2021 18:04:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 17 Feb 2021 18:03:31 +0000 Original-Received: from localhost ([127.0.0.1]:44845 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lCRAh-00009A-1g for submit@debbugs.gnu.org; Wed, 17 Feb 2021 13:03:31 -0500 Original-Received: from lists.gnu.org ([209.51.188.17]:60482) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lCRAf-000092-JC for submit@debbugs.gnu.org; Wed, 17 Feb 2021 13:03:29 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:54710) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lCRAc-00073o-I0 for bug-gnu-emacs@gnu.org; Wed, 17 Feb 2021 13:03:27 -0500 Original-Received: from mx.sdf.org ([205.166.94.24]:49241) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lCRAZ-00012t-Ko for bug-gnu-emacs@gnu.org; Wed, 17 Feb 2021 13:03:26 -0500 Original-Received: from mab (ma.sdf.org [205.166.94.33]) by mx.sdf.org (8.15.2/8.14.5) with ESMTPS id 11HI38e9017961 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256 bits) verified NO); Wed, 17 Feb 2021 18:03:09 GMT In-Reply-To: (Andrea Corallo via's message of "Wed, 17 Feb 2021 09:04:19 +0000") Received-SPF: pass client-ip=205.166.94.24; envelope-from=akrl@sdf.org; helo=mx.sdf.org X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:200209 Archived-At: --=-=-= Content-Type: text/plain Andrea Corallo via "Bug reports for GNU Emacs, the Swiss army knife of text editors" writes: > Andy Moreton writes: > >> On Tue 16 Feb 2021, Andrea Corallo via "Bug reports for GNU Emacs, the Swiss army knife of text editors" wrote: >> >>> Andy could you point out the two libgccjit versions you used specifying >>> wich one was used in the successfull / failed experiment? >> >> It seems they both now fail (and I have lost the build log from the >> successful experiment, so I don't have a note of the commit used). > > That's odd. The culprit of the bug I've isolated is a crash in > libgccjit so should be easy to recognize (we should never crash in > libgccjit). > > Anyway I've an half cooked patch to work around this issue, I guess I'll > test it this evening. A fix like the attached is working around the GCC bug. The only annoyance of this approach is that libgccjit for each compilation is outputting to console: "libgccjit.so: note: disable pass tree-isolate-paths for functions in the range of [0, 4294967295]" We probably also want to check at configure time and raise an error in case configuring --with-nativecomp --with-wide-int but with a (really) old libgccjit that does not provide 'gcc_jit_context_add_command_line_option'. Works for me bootstraping Emacs on i686-pc-linux-gnu + GCC10 but I can't test the Windows side, Andy would you mind giving it a try? Thanks Andrea --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=46495.patch diff --git a/src/comp.c b/src/comp.c index 5e95161030..bb3cd83036 100644 --- a/src/comp.c +++ b/src/comp.c @@ -56,6 +56,7 @@ #undef gcc_jit_block_end_with_return #undef gcc_jit_block_end_with_void_return #undef gcc_jit_context_acquire +#undef gcc_jit_context_add_command_line_option #undef gcc_jit_context_add_driver_option #undef gcc_jit_context_compile_to_file #undef gcc_jit_context_dump_reproducer_to_file @@ -124,6 +125,8 @@ DEF_DLL_FN (const char *, gcc_jit_context_get_first_error, DEF_DLL_FN (gcc_jit_block *, gcc_jit_function_new_block, (gcc_jit_function *func, const char *name)); DEF_DLL_FN (gcc_jit_context *, gcc_jit_context_acquire, (void)); +DEF_DLL_FN (void, gcc_jit_context_add_command_line_option, + (gcc_jit_context *ctxt, const char *optname)); DEF_DLL_FN (void, gcc_jit_context_add_driver_option, (gcc_jit_context *ctxt, const char *optname)); DEF_DLL_FN (gcc_jit_field *, gcc_jit_context_new_field, @@ -312,6 +315,7 @@ init_gccjit_functions (void) LOAD_DLL_FN (library, gcc_jit_struct_set_fields); LOAD_DLL_FN (library, gcc_jit_type_get_const); LOAD_DLL_FN (library, gcc_jit_type_get_pointer); + LOAD_DLL_FN_OPT (library, gcc_jit_context_add_command_line_option); LOAD_DLL_FN_OPT (library, gcc_jit_context_add_driver_option); LOAD_DLL_FN_OPT (library, gcc_jit_global_set_initializer); LOAD_DLL_FN_OPT (library, gcc_jit_version_major); @@ -330,6 +334,7 @@ #define gcc_jit_block_end_with_jump fn_gcc_jit_block_end_with_jump #define gcc_jit_block_end_with_return fn_gcc_jit_block_end_with_return #define gcc_jit_block_end_with_void_return fn_gcc_jit_block_end_with_void_return #define gcc_jit_context_acquire fn_gcc_jit_context_acquire +#define gcc_jit_context_add_command_line_option fn_gcc_jit_context_add_command_line_option #define gcc_jit_context_add_driver_option fn_gcc_jit_context_add_driver_option #define gcc_jit_context_compile_to_file fn_gcc_jit_context_compile_to_file #define gcc_jit_context_dump_reproducer_to_file fn_gcc_jit_context_dump_reproducer_to_file @@ -4400,6 +4405,15 @@ DEFUN ("comp--compile-ctxt-to-file", Fcomp__compile_ctxt_to_file, if (!EQ (HASH_VALUE (func_h, i), Qunbound)) compile_function (HASH_VALUE (func_h, i)); +#if defined (WIDE_EMACS_INT) \ + && (defined (LIBGCCJIT_HAVE_gcc_jit_context_add_command_line_option) \ + || defined (WINDOWSNT)) + Lisp_Object version = Fcomp_libgccjit_version (); + if (!NILP (version) && XFIXNUM (XCAR (version)) >= 10) + gcc_jit_context_add_command_line_option (comp.ctxt, + "-fdisable-tree-isolate-paths"); +#endif + add_driver_options (); if (comp.debug) --=-=-=--