From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Arthur Miller Newsgroups: gmane.emacs.devel Subject: Re: Native compiler - passing command line options to C compiler Date: Wed, 01 Sep 2021 23:06:25 +0200 Message-ID: References: <83bl5fkvky.fsf@gnu.org> <83v93njc3x.fsf@gnu.org> <831r69u5s3.fsf@gnu.org> <83wno0r02e.fsf@gnu.org> <83sfyop7n1.fsf@gnu.org> 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="38112"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) Cc: emacs-devel@gnu.org, akrl@sdf.org To: Eli Zaretskii Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Wed Sep 01 23:07:42 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 1mLXSO-0009h5-9a for ged-emacs-devel@m.gmane-mx.org; Wed, 01 Sep 2021 23:07:41 +0200 Original-Received: from localhost ([::1]:51640 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mLXSN-0002ZW-2B for ged-emacs-devel@m.gmane-mx.org; Wed, 01 Sep 2021 17:07:39 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:33130) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mLXRK-0001sE-06 for emacs-devel@gnu.org; Wed, 01 Sep 2021 17:06:34 -0400 Original-Received: from mail-oln040092073079.outbound.protection.outlook.com ([40.92.73.79]:23717 helo=EUR04-HE1-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mLXRF-0001Br-FN; Wed, 01 Sep 2021 17:06:33 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Y0BCthEmmigARjuEkjaFRfrTbaYbOmIpROuEydKZRXlAE194Tjr8+8CslsyJ9x/g3ytOB0O4rQhdJsI9MG1f3Hy3HTjv0m1y5WEgsaHa7hAK07p8ewdRq5bNsAFbn/f7JjChB+9qg6kbKQDIoHYwjRxdu2w758frtSVioigtXfdOMdPXqA79/TJaoY1Qy1xqiNX1f54NIwO2gPkmr2WU8AXg0YFDM9DN3679wkul6tok7quZ8GMRW8Hv/L8YIb0VfwcZCkztFoGZ51fpKxk4cZWsLJ8MgPFA3s5c5lzzD3PsROfYQuR29q5Xnh4yR/2zKCufAdsBLW76sPO4fUCOWw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=mOMMga4E+LxsM0QhSScU5sOJl7v49aVx1EpY3DP0AIk=; b=jKf1vAqet3/3r5uIw35IKLtxKjlrvMoQw48mcJPFQ9YYJc6kDNoqSSfG/X8JFLXCpvY4FbEyKDRj3koXNnwptlLCYONGJ/VFQsdAUozPIGZIA7dEfmSlBqyuadxx80eFLPlsiaJdokIsy0YaYmFOqAKBnY9t9JkRiedA8nLm7mahZ7S+3FMefSlbkwll/5G49nUc8pF7IYNhNyNBwoUtxio2Ehg3qla8zJ4lz1og33xyY9gGgjVz7JJYxUC6++hWxFgDs2QRQOlnYLVGTe1hx06rSW87MnLKMeIIrJk1A/z+E3oNvqxFXm87SzRSJi+pOy8IqOQtdx5dJ5ef9qU+Tw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=live.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=mOMMga4E+LxsM0QhSScU5sOJl7v49aVx1EpY3DP0AIk=; b=DyGDkxeJKqkgiJO78bUddLAOa2lAeyVocMqUIUf793fSxDX7F4Ea8B+oQRVvV8TXaIIkShHYSIXNwCVweFjL/Qm7aDUjjNShh3e5eEWnrWEd0E3cAUvQVlIVhfubrzRfqwdKWLKK2UdcTZ/Jb+RFOfxPWCCtrt4oqYbQkPP+9jymmY8sTXRCNb1mn1UBjvazHwpV7FecL6a72SCcaZdvKXA/8EI04CuPBhluD+HEsjPQnL9VihHQsXDjMkvbiMKJ8A4BlF9CbgVNF5zZudwo3Mo/nHUEFsZp0JeN7klYy/2tPxbs3ycsjSashJUmbqI1y9npzfmKJP9Ns//qhwwGKQ== Original-Received: from VI1EUR04FT031.eop-eur04.prod.protection.outlook.com (2a01:111:e400:7e0e::4b) by VI1EUR04HT217.eop-eur04.prod.protection.outlook.com (2a01:111:e400:7e0e::218) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4457.17; Wed, 1 Sep 2021 21:06:26 +0000 Original-Received: from DB9PR09MB4986.eurprd09.prod.outlook.com (2a01:111:e400:7e0e::4f) by VI1EUR04FT031.mail.protection.outlook.com (2a01:111:e400:7e0e::254) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4478.19 via Frontend Transport; Wed, 1 Sep 2021 21:06:26 +0000 X-IncomingTopHeaderMarker: OriginalChecksum:60A6C0AA36C189D2A0E36A2388478AEF8396EE4DE2509385847F3407559C3C74; UpperCasedChecksum:84BA1579776014377C3708E94AF6ED4D73A2BAA3FD45273380134917BE80C2DE; SizeAsReceived:8041; Count:46 Original-Received: from DB9PR09MB4986.eurprd09.prod.outlook.com ([fe80::80be:d528:d357:5d3a]) by DB9PR09MB4986.eurprd09.prod.outlook.com ([fe80::80be:d528:d357:5d3a%7]) with mapi id 15.20.4457.024; Wed, 1 Sep 2021 21:06:26 +0000 In-Reply-To: <83sfyop7n1.fsf@gnu.org> (Eli Zaretskii's message of "Wed, 01 Sep 2021 19:45:06 +0300") X-TMN: [MzRjGT1crhJHKxv7xlkeor5sbPStJCEw] X-ClientProxiedBy: AS8PR04CA0156.eurprd04.prod.outlook.com (2603:10a6:20b:331::11) To DB9PR09MB4986.eurprd09.prod.outlook.com (2603:10a6:10:2a9::19) X-Microsoft-Original-Message-ID: <87bl5c6m5q.fsf@live.com> X-MS-Exchange-MessageSentRepresentingType: 1 Original-Received: from pascal.homepc (81.232.177.30) by AS8PR04CA0156.eurprd04.prod.outlook.com (2603:10a6:20b:331::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4478.17 via Frontend Transport; Wed, 1 Sep 2021 21:06:25 +0000 X-MS-PublicTrafficType: Email X-IncomingHeaderCount: 46 X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-Correlation-Id: ec297d8f-9c94-4db9-5fbc-08d96d8c5c50 X-MS-TrafficTypeDiagnostic: VI1EUR04HT217: X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: +xfLqwMelmEotEmLRbC4K30sBmCphFDnlq+Oo+t3KRwg1PkHDahIIYzvuNs4kNKNhx1ji52DVy8tVSUfAUJ7iPaO3w5l/v3+BfBV/H/wd+azDT/71MCDizPp2WRb7LiHfiztRNKaoQV7Hc07vRiiQLtYwTZPgDUaVMRO3EJMnQNjWyobZAhYfPYzYzB2E7GNYW/pNaoBOIlbnSzOscWW4vxMFdtlvn+OfVPT2/UodlLKxYixF65ARAO/nf1yuJJKqpGsOgDceq0Ms7x07epEwmb9b70oKLJpCxKqSH1q6pUsfa9J3kUb50ec8OR/weeKfo0Y9y/RC0EW2MnNBqpPrJq37idHt5RZu+dFSaAowW4fCFKiLQUWA+s+qfpYrlhLjvrz0i5reNxCh3cvv8V0m7WGjmTEwK/5IxmAs1Oo+VZ+MiXskVNAyj+WV/xhCqYu X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: PZVH1RLJoVWtyY+4EjQt8lmZ4nEww/6NFWKWH2VDCXXSCwxwLqsfEIo3h2fVStnHR/WPMIeFgn237wDwADojJRARDa+8GgGAdtcKNwVgeYm1pzFCp1M7G8O65dhZtsBbgsil/o3pYZ//BggTzz1ATw== X-OriginatorOrg: live.com X-MS-Exchange-CrossTenant-Network-Message-Id: ec297d8f-9c94-4db9-5fbc-08d96d8c5c50 X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Sep 2021 21:06:26.5826 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-CrossTenant-AuthSource: VI1EUR04FT031.eop-eur04.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: Internet X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1EUR04HT217 Received-SPF: pass client-ip=40.92.73.79; envelope-from=arthur.miller@live.com; helo=EUR04-HE1-obe.outbound.protection.outlook.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, MSGID_FROM_MTA_HEADER=0.001, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action 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:273686 Archived-At: --=-=-= Content-Type: text/plain Eli Zaretskii writes: >> From: Arthur Miller >> Cc: akrl@sdf.org, emacs-devel@gnu.org >> Date: Wed, 01 Sep 2021 16:23:21 +0200 >> >> > Almost there: the commit log message should mention the files and >> > functions where you made the changes. Look at the other log messages >> > in git, and you will see the difference (feel free to ask if still >> > unclear). >> > >> > Thanks for working on this. >> >> See if this is ok. I don't know how to get in ` into git message. My bash is >> complaining, but I see in some git log that Lars had quoted some names with `'. >> >> Found also one check for WINDOWS I forgott to remove. >> >> See if this one is ok: >> * lisp/emacs-lisp/comp.el: add user option 'native-comp-compiler-options' >> and rename 'native-comp-driver-options' to 'native-comp-backend-options' >> with changes needed to implement the feature and the rename. >> >> * list/emacs-lisp/bytecomp.el: adapt to the change in comp.el. >> >> * src/comp.c: add support to implement 'native-comp-compiler-options' and >> the rename of driver options to backend options. > > This part should look like this: > > * lisp/emacs-lisp/comp.el ('native-comp-compiler-options): New option. > (native-comp-driver-options): Rename to 'native-comp-backend-options'. > * list/emacs-lisp/bytecomp.el: All users of 'native-comp-driver-options' > changed. > > * src/comp.c (Fcomp_native_backend_options_effective_p): Renamed > from 'Fcomp_native_driver_options_effective_p'; all callers changed. > (Fcomp_native_compiler_options_effective_p): New function. > (add_driver_options): Remove WINDOWSNT condition. > (add_compiler_options): New function. > (Fcomp__compile_ctxt_to_file): Call 'add_compiler_options'. > > IOW, you need to list not only the files, but also the functions and > global variables that you change. And I who tried to be brief for once. > This will be much easier if you use "C-x 4 a" or "C-c C-d" (the latter > in the VC log buffer): they will generate the skeleton with file name > and function name for you, so you need just add the description of the > change itself, what's after the colon. Aha. I never used Emacs vc functions, I just did everything from command line in ansi-term. I have my bash aliases I am used to and most of my git interaction is thru them. I now have read about vc in the manual and looked around after you wrote this, but I seem to be missing something in setup. I opened some vc log and C-c C-d opened diff view as if I did a git format-patch which was nice, but then when I actually run vc-register followed by vc-next-action, the opened log said that diff something wasn't registered. I will try to read more and see if I can get it to work, it seems useful to get skeleton with functions auto generated. > (I can fix the log message for you this time, if you are exhausted ;-) No worries, I have at least mastered git reset --soft HEAD~1. I did took your text this time se we get over with it. Thank you for your kind help and guidance. --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=ncomp-options.patch >From 22ba2fe39d17f264799263605d2a2bb5bc22bb7b Mon Sep 17 00:00:00 2001 From: Arthur Miller Date: Wed, 1 Sep 2021 22:52:25 +0200 Subject: [PATCH] Native comp add/change GCC command-line options Added support for GCC command-line options and renamed native-comp-driver-options to 'native-comp-backend-options' to better reflect which options are passed to GCC. * lisp/emacs-lisp/comp.el ('native-comp-compiler-options): New option. (native-comp-driver-options): Rename to 'native-comp-backend-options'. * list/emacs-lisp/bytecomp.el: All users of 'native-comp-driver-options' changed. * src/comp.c (Fcomp_native_backend_options_effective_p): Renamed from 'Fcomp_native_driver_options_effective_p'; all callers changed. (Fcomp_native_compiler_options_effective_p): New function. (add_driver_options): Remove WINDOWSNT condition. (add_compiler_options): New function. (Fcomp__compile_ctxt_to_file): Call 'add_compiler_options'. --- lisp/emacs-lisp/bytecomp.el | 4 +- lisp/emacs-lisp/comp.el | 36 +++++++++++---- src/comp.c | 90 +++++++++++++++++++++++++++++-------- 3 files changed, 101 insertions(+), 29 deletions(-) diff --git a/lisp/emacs-lisp/bytecomp.el b/lisp/emacs-lisp/bytecomp.el index 145cdbaa6e..c2f7b951d9 100644 --- a/lisp/emacs-lisp/bytecomp.el +++ b/lisp/emacs-lisp/bytecomp.el @@ -2257,8 +2257,8 @@ byte-compile-from-buffer (push `(native-comp-speed . ,native-comp-speed) byte-native-qualities) (defvar native-comp-debug) (push `(native-comp-debug . ,native-comp-debug) byte-native-qualities) - (defvar native-comp-driver-options) - (push `(native-comp-driver-options . ,native-comp-driver-options) + (defvar native-comp-backend-options) + (push `(native-comp-backend-options . ,native-comp-backend-options) byte-native-qualities) (defvar no-native-compile) (push `(no-native-compile . ,no-native-compile) diff --git a/lisp/emacs-lisp/comp.el b/lisp/emacs-lisp/comp.el index 80a1da5ad8..30febaf7d8 100644 --- a/lisp/emacs-lisp/comp.el +++ b/lisp/emacs-lisp/comp.el @@ -166,14 +166,24 @@ native-comp-async-query-on-exit :type 'boolean :version "28.1") -(defcustom native-comp-driver-options nil +(defcustom native-comp-compiler-options nil + "Command line options passed verbatim to GCC compiler. +Note that not all options are meaningful and some options might even +break your Emacs. Use at own risk. + +Passing these options is only available in libgccjit version 9 +and above." + :type '(repeat string) + :version "28.1") + +(defcustom native-comp-backend-options nil "Options passed verbatim to the native compiler's back-end driver. Note that not all options are meaningful; typically only the options affecting the assembler and linker are likely to be useful. Passing these options is only available in libgccjit version 9 and above." - :type '(repeat string) ; FIXME is this right? + :type '(repeat string) :version "28.1") (defcustom comp-libgccjit-reproducer nil @@ -755,8 +765,10 @@ comp-data-container :documentation "Default speed for this compilation unit.") (debug native-comp-debug :type number :documentation "Default debug level for this compilation unit.") - (driver-options native-comp-driver-options :type list - :documentation "Options for the GCC driver.") + (compiler-options native-comp-compiler-options :type list + :documentation "Options for the GCC compiler.") + (backend-options native-comp-backend-options :type list + :documentation "Options for the GCC driver.") (top-level-forms () :type list :documentation "List of spilled top level forms.") (funcs-h (make-hash-table :test #'equal) :type hash-table @@ -1347,7 +1359,9 @@ comp-spill-lap-function byte-native-qualities) (comp-ctxt-debug comp-ctxt) (alist-get 'native-comp-debug byte-native-qualities) - (comp-ctxt-driver-options comp-ctxt) (alist-get 'native-comp-driver-options + (comp-ctxt-compiler-options comp-ctxt) (alist-get 'native-comp-compiler-options + byte-native-qualities) + (comp-ctxt-backend-options comp-ctxt) (alist-get 'native-comp-backend-options byte-native-qualities) (comp-ctxt-top-level-forms comp-ctxt) (cl-loop @@ -3663,8 +3677,10 @@ comp-final comp-libgccjit-reproducer ,comp-libgccjit-reproducer comp-ctxt ,comp-ctxt native-comp-eln-load-path ',native-comp-eln-load-path - native-comp-driver-options - ',native-comp-driver-options + native-comp-backend-options + ',native-comp-backend-options + native-comp-compiler-options + ',native-comp-compiler-options load-path ',load-path) ,native-comp-async-env-modifier-form (message "Compiling %s..." ',output) @@ -3926,8 +3942,10 @@ comp-run-async-workers comp-libgccjit-reproducer ,comp-libgccjit-reproducer comp-async-compilation t native-comp-eln-load-path ',native-comp-eln-load-path - native-comp-driver-options - ',native-comp-driver-options + native-comp-backend-options + ',native-comp-backend-options + native-comp-compiler-options + ',native-comp-compiler-options load-path ',load-path warning-fill-column most-positive-fixnum) ,native-comp-async-env-modifier-form diff --git a/src/comp.c b/src/comp.c index 3ea2836560..7dfb4c7f23 100644 --- a/src/comp.c +++ b/src/comp.c @@ -509,7 +509,8 @@ #define NUM_CAST_TYPES 15 typedef struct { EMACS_INT speed; EMACS_INT debug; - Lisp_Object driver_options; + Lisp_Object backend_options; + Lisp_Object compiler_options; gcc_jit_context *ctxt; gcc_jit_type *void_type; gcc_jit_type *bool_type; @@ -4361,15 +4362,14 @@ DEFUN ("comp--release-ctxt", Fcomp__release_ctxt, Scomp__release_ctxt, } #pragma GCC diagnostic ignored "-Waddress" -DEFUN ("comp-native-driver-options-effective-p", - Fcomp_native_driver_options_effective_p, - Scomp_native_driver_options_effective_p, +DEFUN ("comp-native-backend-options-effective-p", + Fcomp_native_backend_options_effective_p, + Scomp_native_backend_options_effective_p, 0, 0, 0, - doc: /* Return t if `comp-native-driver-options' is effective. */) + doc: /* Return t if `comp-native-backend-options' is effective. */) (void) { -#if defined (LIBGCCJIT_HAVE_gcc_jit_context_add_driver_option) \ - || defined (WINDOWSNT) +#if defined (LIBGCCJIT_HAVE_gcc_jit_context_add_driver_option) if (gcc_jit_context_add_driver_option) return Qt; #endif @@ -4377,15 +4377,30 @@ DEFUN ("comp-native-driver-options-effective-p", } #pragma GCC diagnostic pop +#pragma GCC diagnostic ignored "-Waddress" +DEFUN ("comp-native-compiler-options-effective-p", + Fcomp_native_compiler_options_effective_p, + Scomp_native_compiler_options_effective_p, + 0, 0, 0, + doc: /* Return t if `comp-native-compiler-options' is effective. */) + (void) +{ +#if defined (LIBGCCJIT_HAVE_gcc_jit_context_add_command_line_option) + if (gcc_jit_context_add_command_line_option) + return Qt; +#endif + return Qnil; +} +#pragma GCC diagnostic pop + static void add_driver_options (void) { Lisp_Object options = Fsymbol_value (Qnative_comp_driver_options); -#if defined (LIBGCCJIT_HAVE_gcc_jit_context_add_driver_option) \ - || defined (WINDOWSNT) +#if defined (LIBGCCJIT_HAVE_gcc_jit_context_add_driver_option) load_gccjit_if_necessary (true); - if (!NILP (Fcomp_native_driver_options_effective_p ())) + if (!NILP (Fcomp_native_backend_options_effective_p ())) FOR_EACH_TAIL (options) gcc_jit_context_add_driver_option (comp.ctxt, /* FIXME: Need to encode @@ -4397,15 +4412,14 @@ add_driver_options (void) if (CONSP (options)) xsignal1 (Qnative_compiler_error, build_string ("Customizing native compiler options" - " via `comp-native-driver-options' is" + " via `comp-native-backend-options' is" " only available on libgccjit version 9" " and above.")); /* Captured `comp-native-driver-options' because file-local. */ -#if defined (LIBGCCJIT_HAVE_gcc_jit_context_add_driver_option) \ - || defined (WINDOWSNT) - options = comp.driver_options; - if (!NILP (Fcomp_native_driver_options_effective_p ())) +#if defined (LIBGCCJIT_HAVE_gcc_jit_context_add_driver_option) + options = comp.backend_options; + if (!NILP (Fcomp_native_backend_options_effective_p ())) FOR_EACH_TAIL (options) gcc_jit_context_add_driver_option (comp.ctxt, /* FIXME: Need to encode @@ -4416,6 +4430,43 @@ add_driver_options (void) #endif } +static void +add_compiler_options (void) +{ + Lisp_Object options = Fsymbol_value (Qnative_comp_compiler_options); + +#if defined (LIBGCCJIT_HAVE_gcc_jit_context_add_command_line_option) + load_gccjit_if_necessary (true); + if (!NILP (Fcomp_native_compiler_options_effective_p ())) + FOR_EACH_TAIL (options) + gcc_jit_context_add_command_line_option (comp.ctxt, + /* FIXME: Need to encode + this, but how? either + ENCODE_FILE or + ENCODE_SYSTEM. */ + SSDATA (XCAR (options))); +#endif + if (CONSP (options)) + xsignal1 (Qnative_compiler_error, + build_string ("Customizing native compiler options" + " via `comp-native-compiler-options' is" + " only available on libgccjit version 9" + " and above.")); + + /* Captured `comp-native-compiler-options' because file-local. */ +#if defined (LIBGCCJIT_HAVE_gcc_jit_context_add_command_line_option) + options = comp.compiler_options; + if (!NILP (Fcomp_native_compiler_options_effective_p ())) + FOR_EACH_TAIL (options) + gcc_jit_context_add_command_line_option (comp.ctxt, + /* FIXME: Need to encode + this, but how? either + ENCODE_FILE or + ENCODE_SYSTEM. */ + SSDATA (XCAR (options))); +#endif +} + DEFUN ("comp--compile-ctxt-to-file", Fcomp__compile_ctxt_to_file, Scomp__compile_ctxt_to_file, 1, 1, 0, @@ -4460,7 +4511,7 @@ DEFUN ("comp--compile-ctxt-to-file", Fcomp__compile_ctxt_to_file, eassert (comp.speed < INT_MAX); comp.debug = XFIXNUM (CALL1I (comp-ctxt-debug, Vcomp_ctxt)); eassert (comp.debug < INT_MAX); - comp.driver_options = CALL1I (comp-ctxt-driver-options, Vcomp_ctxt); + comp.backend_options = CALL1I (comp-ctxt-backend-options, Vcomp_ctxt); if (comp.debug) gcc_jit_context_set_bool_option (comp.ctxt, @@ -4536,6 +4587,7 @@ DEFUN ("comp--compile-ctxt-to-file", Fcomp__compile_ctxt_to_file, #endif add_driver_options (); + add_compiler_options (); if (comp.debug > 1) gcc_jit_context_dump_to_file (comp.ctxt, @@ -5241,7 +5293,8 @@ syms_of_comp (void) DEFSYM (Qnative_comp_speed, "native-comp-speed"); DEFSYM (Qnative_comp_debug, "native-comp-debug"); - DEFSYM (Qnative_comp_driver_options, "native-comp-driver-options"); + DEFSYM (Qnative_comp_backend_options, "native-comp-backend-options"); + DEFSYM (Qnative_comp_compiler_options, "native-comp-compiler-options"); DEFSYM (Qcomp_libgccjit_reproducer, "comp-libgccjit-reproducer"); /* Limple instruction set. */ @@ -5350,7 +5403,8 @@ syms_of_comp (void) defsubr (&Scomp__subr_signature); defsubr (&Scomp_el_to_eln_rel_filename); defsubr (&Scomp_el_to_eln_filename); - defsubr (&Scomp_native_driver_options_effective_p); + defsubr (&Scomp_native_backend_options_effective_p); + defsubr (&Scomp_native_compiler_options_effective_p); defsubr (&Scomp__install_trampoline); defsubr (&Scomp__init_ctxt); defsubr (&Scomp__release_ctxt); -- 2.33.0 --=-=-=--