all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Arthur Miller <arthur.miller@live.com>
To: Eli Zaretskii <eliz@gnu.org>
Cc: emacs-devel@gnu.org
Subject: Re: Native compiler - passing command line options to C compiler
Date: Mon, 30 Aug 2021 16:01:22 +0200	[thread overview]
Message-ID: <AM9PR09MB497727D7F150C13535C753FA96CB9@AM9PR09MB4977.eurprd09.prod.outlook.com> (raw)
In-Reply-To: <83bl5fkvky.fsf@gnu.org> (Eli Zaretskii's message of "Mon, 30 Aug 2021 14:42:21 +0300")

Eli Zaretskii <eliz@gnu.org> writes:

>> From: Arthur Miller <arthur.miller@live.com>
>> 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!



  parent reply	other threads:[~2021-08-30 14:01 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <AM9PR09MB49778CFA83AA6697D09ED01B96CA9@AM9PR09MB4977.eurprd09.prod.outlook.com>
2021-08-30  9:36 ` Native compiler - passing command line options to C compiler Andrea Corallo via Emacs development discussions.
2021-08-30 13:56   ` Arthur Miller
2021-08-30 14:05     ` Andrea Corallo via Emacs development discussions.
2021-08-30 11:42 ` Eli Zaretskii
2021-08-30 12:59   ` Andrea Corallo via Emacs development discussions.
2021-08-30 13:28     ` Eli Zaretskii
2021-08-30 14:28       ` Andrea Corallo via Emacs development discussions.
2021-08-30 15:00         ` Arthur Miller
2021-08-30 15:38           ` Andrea Corallo via Emacs development discussions.
2021-08-31  5:36             ` Arthur Miller
2021-08-31  8:06               ` Andrea Corallo via Emacs development discussions.
2021-08-31 13:01               ` Eli Zaretskii
2021-08-31 22:53                 ` Arthur Miller
2021-09-01 11:45                   ` Eli Zaretskii
2021-09-01 14:23                     ` Arthur Miller
2021-09-01 16:45                       ` Eli Zaretskii
2021-09-01 21:06                         ` Arthur Miller
2021-08-30 16:01           ` Eli Zaretskii
2021-08-30 15:50         ` Eli Zaretskii
2021-08-30 14:01   ` Arthur Miller [this message]
2021-08-30 14:03     ` Eli Zaretskii
2021-09-01 14:58   ` Alex Bennée
2021-09-01 15:10     ` Perry E. Metzger
2021-09-01 16:04     ` Eli Zaretskii

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=AM9PR09MB497727D7F150C13535C753FA96CB9@AM9PR09MB4977.eurprd09.prod.outlook.com \
    --to=arthur.miller@live.com \
    --cc=eliz@gnu.org \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.