From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.devel Subject: Re: Native compiler - passing command line options to C compiler Date: Mon, 30 Aug 2021 18:50:39 +0300 Message-ID: <83o89fj5io.fsf@gnu.org> References: <83bl5fkvky.fsf@gnu.org> <83v93njc3x.fsf@gnu.org> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="31798"; mail-complaints-to="usenet@ciao.gmane.io" Cc: arthur.miller@live.com, emacs-devel@gnu.org To: Andrea Corallo Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Mon Aug 30 17:51:34 2021 Return-path: Envelope-to: ged-emacs-devel@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 1mKjZN-00086X-II for ged-emacs-devel@m.gmane-mx.org; Mon, 30 Aug 2021 17:51:33 +0200 Original-Received: from localhost ([::1]:36594 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mKjZM-0004cM-FT for ged-emacs-devel@m.gmane-mx.org; Mon, 30 Aug 2021 11:51:32 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:40046) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mKjYh-0003v1-IU for emacs-devel@gnu.org; Mon, 30 Aug 2021 11:50:51 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]:51376) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mKjYe-0001eZ-W0; Mon, 30 Aug 2021 11:50:49 -0400 Original-Received: from 84.94.185.95.cable.012.net.il ([84.94.185.95]:2557 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mKjYd-0002kg-MV; Mon, 30 Aug 2021 11:50:48 -0400 In-Reply-To: (message from Andrea Corallo on Mon, 30 Aug 2021 14:28:18 +0000) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.io gmane.emacs.devel:273509 Archived-At: > From: Andrea Corallo > Cc: arthur.miller@live.com, emacs-devel@gnu.org > Date: Mon, 30 Aug 2021 14:28:18 +0000 > > > You cannot use a libgccjit.dll of a version for which Emacs was not > > compiled, unless it is binary-compatible. If Emacs was linked against > > libgccjit.dll that didn't support > > gcc_jit_context_add_command_line_option, then it would not work to > > install a newer version of the DLL that does. > > Okay, I thought on Windows worked differently and we could handle the > case of a symbol not available at compile time but at runtime. On Windows, we delay loading the libgccjit DLL until it is first needed, but when it load it, we find the addresses of all the functions we want to import from the library, and any function that is not in the library will cause the initialization to fail. See init_gccjit_functions, and examine the definition of the LOAD_DLL_FN macro. So if someone has a libgccjit DLL without the gcc_jit_context_add_command_line_option function, they will be unable to use native-compilation. Btw, since we already expect gcc_jit_context_add_command_line_option to exist unconditionally on WINDOWSNT, I guess the test for LIBGCCJIT_HAVE_gcc_jit_context_add_command_line_option is indeed not needed on WINDOWSNT, because we implicitly assume it will always succeed. But I'd like to avoid tricky code if possible.