Subject: bug#50666: 28.0.50; Fix native compilation on Cygwin

From: Andrea Corallo <[email-masked]>
Date: Thu, 23 Sep 2021 19:11:05 +0000

Eli Zaretskii <[email-masked]> writes:

>> Cc: [email-masked], [email-masked]
>> From: Ken Brown <[email-masked]>
>> Date: Wed, 22 Sep 2021 17:35:28 -0400
>> 
>> We've made a good start on the Cygwin side, but I have a question about how to 
>> integrate it into Emacs.
>
> I added Andrea to this discussion, as he knows more than anyone else
> about the Emacs side of this stuff.
>
>> Let's say we have a script that I'll call "rebase" for the purpose of this 
>> discussion, which rebases all the eln files in ~/.emacs.d/eln-cache.  The user 
>> would then start Emacs via a script that first calls rebase and then starts 
>> Emacs.
>
> Is it really necessary to rebase the *.eln files before each startup?
> Isn't it enough to rebase each of the .eln files just once, when it is
> produced?  If indeed this is needed every time, can you explain why?
>
>> Within Emacs, I would then want to do something like
>> 
>> (if (eq system-type 'cygwin)
>>      (call-process "rebase" nil
>>                    '(:file "<log file>")
>>                    nil "<arg>" ...))
>> 
>> after every compilation but before the compiled file is loaded.
>> 
>> I'm not familiar enough with native compilation to know where this should go. 
>
> The non-preloaded *.eln files are all loaded by native-elisp-load, so
> I guess the rebase should be launched from there?  The preloaded *.eln
> files are loaded in pdumper.c:dump_do_dump_relocation, but do we need
> to support non-rebased preloaded *.eln files?

Yes I think too `native-elisp-load' and `dump_do_dump_relocation' are
the two places we'd want to trigger the rebase (not sure if in
`dump_do_dump_relocation' we are already able to spawn subprocesses
tho).

That said I'm wondering what is going to happen if an Emacs is running
and a second sessions starts rebasing some eln.

  Andrea