emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] [WIP] Port feature/native-comp to Windows.


From: Nicolas Bértolo
Subject: Re: [PATCH] [WIP] Port feature/native-comp to Windows.
Date: Sun, 10 May 2020 14:50:52 -0300

> What information do we need, exactly?

We need:
- The name of the setjmp function.
- Whether it needs a second parameter, in that case:
   - It can be a gcc builtin, a function call or a NULL constant.
   - If it is a function call or a builtin it may need a parameter.
     This is a NULL constant in all cases I have seen.

> What is the definition of " where the gcc installation lives"?  What
> files does libgccjit need from that place, and how does it look for
> those files?

libgccjit implements generates an assembler file. This is done without any calls
to any external program. Then it calls a gcc entry point to finish the process.
This calls the same functions that the `gcc` program uses to identify where it
was installed. In particular, it uses constants defined at libgccjit build time
(the compiler version, the directories where it was installed, etc.). It uses
that information plus some environment variables: GCC_EXEC_PREFIX, LIBRARY_PATH,
maybe others, to find where the gcc support files are installed: the support
binaries, libgcc. This is what I meant by "where the gcc installation lives".

This logic runs inside the Emacs process that is performing the compilation
process, but it is the same code that would run in a `gcc -print-*` IIUC.

> IIUC what is needed, it should be relatively easy to glean this
> information from the output of "gcc -print-file-name=" and its ilk.

libgccjit runs the exact same code as gcc would. So this would not help.
Moreover, how would Emacs find gcc? We would need to add it to PATH.

> Using the above-mentioned -print-* options to GCC should accomplish
> the same tasks, because they ask GCC to reveal the places where it
> finds its auxiliary binaries and support libraries.  Isn't it enough
> to find out the absolute file names of each such file/program, and
> tell libgccjit to use that absolute file name, instead of using -B?

I do not think that is possible. libgccjit likes to find the files it needs as
if it was a gcc instance.

> I'd like to avoid that: it's a nuisance to have to copy files that
> way, and users could legitimately have more than one GCC version
> installed and available at the same time.

AFAIU, we need to use the same GCC version, that is what libgccjit looks for.
Also, the only things it needs are the assembler, linker and support libraries.

Using support libraries from different GCC versions may cause weird bugs. It is
not a good idea IMHO.

> That assumes that Emacs is configured and built on the same system
> where it is used.  That assumption is mostly false for Windows, where
> many users simply download and install precompiled binaries, or build
> on one system and then use on several different ones.  We should try
> to find a way of getting this information at run time, not at
> configure time.  And it shouldn't be hard: we can use at run time the
> same GCC options as the configure script would do.  This should be
> done once, and the result stored in some FOO-directory variable for
> use when Lisp should be compiled.

This would mean that users would have to download the appropriate GCC version if
they want to use native lisp compilation, ensure that Emacs finds it, etc. By
copying the support files into the installation dir we ensure that Emacs finds
the correct files and it works out of the box for users that download a ZIP
file.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]