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: Mon, 30 Aug 2021 16:01:22 +0200 Message-ID: References: <83bl5fkvky.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="14335"; 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 To: Eli Zaretskii Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Mon Aug 30 16:04:09 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 1mKhtQ-0003Rk-HK for ged-emacs-devel@m.gmane-mx.org; Mon, 30 Aug 2021 16:04:09 +0200 Original-Received: from localhost ([::1]:54060 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mKhtP-0007qY-BP for ged-emacs-devel@m.gmane-mx.org; Mon, 30 Aug 2021 10:04:07 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:46128) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mKhqu-0005Dl-0G for emacs-devel@gnu.org; Mon, 30 Aug 2021 10:01:32 -0400 Original-Received: from mail-am6eur05olkn2074.outbound.protection.outlook.com ([40.92.91.74]:44513 helo=EUR05-AM6-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 1mKhqp-0007Q8-6V; Mon, 30 Aug 2021 10:01:31 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=R3HKAw7X+/77FFqUYo3DXMPgCV7sf5Lp3YHmUebmyQNwwHzo4iRb3KJoi1FEAYoHhJTNg0yZChY2YCqTfcRMH8PRcNeJN8xzKYHBwsp/DT77tOJXrJZHPRacl02KBavpNcqINJ/a+0HrH8Hu1ddIFumiiiB0EutckWiVKZWV81UlaMJ4JpoHHITnRJ7hkVGHxAmEGJ3RRG7z6Bw5v4kAQkBx9Tj49Fmm5M9Y0bAtsvlIFTkqOU4WyjW40/Sns/SUHgH4H5gCD1sF9RQeyM+NGJGy27rKqZmExJ7OUUdeei3sc5R07ApFlCQAJ+oVr+4PodHhS2yHYnz/Net5fBD2zg== 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=ANkjyr92azrh2qRU1KHvBrZYhpFmrLyTiN/mTqQLxK4=; b=APrshdb0wHKHnGqLQR1POPd20CCi9ldYcthfiYQxzkPWVayqT5662BzKwJ3awOtAyQB/rrXU8Q0lWIzBtg37jOCflW2q5RtyFXTf9l+WqK1AkTDIZStSvn7ENWwY/4jXs4dIztY2N1uon6DWVQxzvJohaHUGm9rvnl+8vx3jsGA0ktI5wSiK29/r9PY+GE5+bJM5sEnczqJLhqa8tV3QI/AFfIOhND5qioKla50OFJo+vx+o0e4rFW2PixJ0p2FT8YYSZbxzJHqUsXNuzDHWiIWkmn4+YOvLVlE8Dmrg3CZOaJj7ymGkx/DlgFG+3GhqVa/XWFX4S+Fgy+sNxx0bNQ== 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=ANkjyr92azrh2qRU1KHvBrZYhpFmrLyTiN/mTqQLxK4=; b=krXrnaST1jxK3vQ2FuuirgGhnwH5+Da/4r6RMMy53KeXcfg2+SnFB1WTLZuN3HykNA7V8Jz+Xp+s61yMGpzE1p/xrnMm0bJNNa7dwC01hiBTAA0kLSojfdPhxCD0cIjB0lMptn5azFRm15NRjKokVchkpGAosUyXmKT0dggaS1M2qlaakPLswYtkYIRM0EDzDHGttzQ8l7zWHYEdnRUnEOIVAwddL/a6p8r5AqvorDX5RPEuExXFHv4KXWKytcqfwcT9re1szGCmapO1F4lbU1hP+zo7bcM2JU0PonUlhf6jUtgoXM2EejBUaOPI++LZLoprqHpGsBDcFPWe2asQuA== Original-Received: from DB8EUR05FT058.eop-eur05.prod.protection.outlook.com (2a01:111:e400:fc0f::45) by DB8EUR05HT187.eop-eur05.prod.protection.outlook.com (2a01:111:e400:fc0f::368) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4457.17; Mon, 30 Aug 2021 14:01:23 +0000 Original-Received: from AM9PR09MB4977.eurprd09.prod.outlook.com (2a01:111:e400:fc0f::45) by DB8EUR05FT058.mail.protection.outlook.com (2a01:111:e400:fc0f::164) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4457.17 via Frontend Transport; Mon, 30 Aug 2021 14:01:23 +0000 X-IncomingTopHeaderMarker: OriginalChecksum:FA45F3125E1370B0648D790B7B27008F556750F6B3C26AB0A3C5D4B577A092EB; UpperCasedChecksum:8C3EE463B0F05C9014EDB17618BAE0D7DB3F138DB310D9185E08D44A1D6E3BC6; SizeAsReceived:7477; Count:46 Original-Received: from AM9PR09MB4977.eurprd09.prod.outlook.com ([fe80::35f2:ac79:ee50:c46c]) by AM9PR09MB4977.eurprd09.prod.outlook.com ([fe80::35f2:ac79:ee50:c46c%8]) with mapi id 15.20.4457.024; Mon, 30 Aug 2021 14:01:23 +0000 In-Reply-To: <83bl5fkvky.fsf@gnu.org> (Eli Zaretskii's message of "Mon, 30 Aug 2021 14:42:21 +0300") X-TMN: [46zXAt3d8Fudb2LYiGQdO3L06Oh7Nva8] X-ClientProxiedBy: AM5PR0601CA0045.eurprd06.prod.outlook.com (2603:10a6:203:68::31) To AM9PR09MB4977.eurprd09.prod.outlook.com (2603:10a6:20b:304::20) X-Microsoft-Original-Message-ID: <87k0k39glp.fsf@live.com> X-MS-Exchange-MessageSentRepresentingType: 1 Original-Received: from pascal.homepc (81.232.177.30) by AM5PR0601CA0045.eurprd06.prod.outlook.com (2603:10a6:203:68::31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4457.20 via Frontend Transport; Mon, 30 Aug 2021 14:01:23 +0000 X-MS-PublicTrafficType: Email X-IncomingHeaderCount: 46 X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-Correlation-Id: ac484825-c639-4cd5-8d38-08d96bbea698 X-MS-TrafficTypeDiagnostic: DB8EUR05HT187: X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: TzISUqd3vtVRG6ngcLCCA/OheYXnEp66TLom9YdDmwv8WNwh+UXq/AHmVNHWSFNuN72TembBc9uA+sZh5rp16syJcFNDfVfUaDGoA6wVyG+LCAmg3tTT+/9aZ5OVm8iG1MLAx4ndPyWBBj+AEQrhQe/vhszg0rN8gVwXA9X+3YfsdVNdCwCjDZqDXr6VbiLMXchqnpXpr9/plVN76Pva/G+ONsm+8k4KIpJUbzBYYM9FQ4NWGbvpYciPDkPPCIoyJC4J1kUIVn0V5Etw38QFzR0ZiZWd4gln684ZorLfPDG8Stu1Bhz2raLMYlC+5dFg5c/ye8YZJ8kUbWo5XTHe21HR8Wrc+HQC34qdXxR2lQIgQTv5woNm+R8W4t2lZo6g6/joBy/8+C5RBYVPMs/3TgTdSz7xPaDxeKaU4+qq3N04f/qXLoZUgJvl0Z+VZBPF X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: TcpxsBoahItkOs7pCQ3oWkcCWf+VjF1D9SGXoAuZic5eVyHi8g/1vIIc60NS/XK8CSz2XXu4iv8F9Ai2hgscaHlaeI5+cRfYEP95sDdzpALF7wEK4j2s/BeULYTLBa+yMyVIFuOii5rU7n2vEOQAkA== X-OriginatorOrg: live.com X-MS-Exchange-CrossTenant-Network-Message-Id: ac484825-c639-4cd5-8d38-08d96bbea698 X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Aug 2021 14:01:23.5686 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-CrossTenant-AuthSource: DB8EUR05FT058.eop-eur05.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: DB8EUR05HT187 Received-SPF: pass client-ip=40.92.91.74; envelope-from=arthur.miller@live.com; helo=EUR05-AM6-obe.outbound.protection.outlook.com X-Spam_score_int: -16 X-Spam_score: -1.7 X-Spam_bar: - X-Spam_report: (-1.7 / 5.0 requ) BAYES_00=-1.9, DKIM_INVALID=0.1, DKIM_SIGNED=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_PASS=-0.001, T_SPF_HELO_TEMPERROR=0.01 autolearn=no 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:273496 Archived-At: Eli Zaretskii writes: >> From: Arthur Miller >> Date: Sun, 29 Aug 2021 23:47:56 +0200 >> >> after the few mails the other day, I wasn't really sure if Andrea is going to >> implement it and when. I thought it was rather a tedious manual labour and maybe >> not so important, so I took me a liberty to implement this myself in my own, so >> called, personal copy of Eamcs sources. > > Thanks. > >> I am not sure if I have done it correctly though, I appreciate if Andrea have >> time to take a look; I have just mainly copied your code for backend options. It >> seems to work for me, with a minor remark: When I pass a valid option, "native", >> in place where it should go, I get an invalid option error. Gcc even lists it in >> the error message as a valid option. Another option "skylake" works just >> fine. This seems to vary between flags. I am not sure if this is some encoding >> error from Emacs to libgccjit, or if it is some bug in libgccjit, or is it just >> my brain having dumps. > > I guess -march=native is something handled by GCC itself, and here we > don't have it? If you want to be sure, ask this question on the GCC > list, or report as a bug to their Bugzilla. > >> +break your code. Use at own risk. > ^^ > Two spaces between sentences. Ah, why did I forgott that one :). >> +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) \ >> + || defined (WINDOWSNT) <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< >> + if (gcc_jit_context_add_command_line_option) >> + return Qt; >> +#endif > > The emphasized part doesn't look right: we did that elsewhere because > the options we pass there work around bugs that happen also in > versions that don't report libgccjit version. But here this is not > needed, and the version check isn't present anyway. So the WINDOWSNT > special handling should be removed, I think. Ok. I am not familiar with the details of how and why, so I just left it. I can remove it. >> +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) \ >> + || defined (WINDOWSNT) >> + load_gccjit_if_necessary (true); >> + if (!NILP (Fcomp_native_compiler_options_effective_p ())) > > Likewise here. And since Fcomp_native_compiler_options_effective_p > already does this test, why did you need to have another test outside > it? That was just copy pasta. I have noticed that and reflected over that, but I didn't want to poke too much into stuff. >> + /* Captured `comp-native-driver-options' because file-local. */ >> +#if defined (LIBGCCJIT_HAVE_gcc_jit_context_add_command_line_option) \ >> + || defined (WINDOWSNT) >> + 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 > > Likewise here. Yes, I'll fix Windows case. If you would like me to test it on Windows it will take time. Maybe tomorrow or day after. I can send in patch when I tested to save everyones time. Thanks for the help and clarifications!