GNU bug report logs - #50666
28.0.50; Fix native compilation on Cygwin

Previous Next

Package: emacs;

Reported by: Ken Brown <kbrown <at> cornell.edu>

Date: Sat, 18 Sep 2021 20:52:02 UTC

Severity: normal

Tags: patch

Found in version 28.0.50

Done: Ken Brown <kbrown <at> cornell.edu>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Eli Zaretskii <eliz <at> gnu.org>
To: Ken Brown <kbrown <at> cornell.edu>, Andrea Corallo <akrl <at> sdf.org>
Cc: Stromeko <at> nexgo.de, 50666 <at> debbugs.gnu.org
Subject: bug#50666: 28.0.50; Fix native compilation on Cygwin
Date: Thu, 23 Sep 2021 10:42:33 +0300
> Cc: Stromeko <at> nexgo.de, 50666 <at> debbugs.gnu.org
> From: Ken Brown <kbrown <at> cornell.edu>
> 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?

> Or maybe it has to be done in more than one place, depending on whether the 
> compilation is synchronous or not.
> 
> Can you help?

I hope the above helps.  But I think we should understand better all
the aspects of this issue, to make sure it will work correctly in the
wild.  The *.eln files bring quite a few new and unusual aspects and
dependencies to Emacs, they are not just another kind of DLLs loaded
dynamically.  So I'd appreciate if you explained:

  . why is rebasing needed (I think I understand that part, but I'd
    prefer an explanation from the experts)
  . how will the 'rebase' utility determine to which address to remap
    each .eln file

> P.S. The rebase script will fail to rebase eln files that are already loaded, 
> but that's harmless in the scenario above.

When an updated .eln file is produced for .eln that is loaded into
some running Emacs, Emacs on Windows renames the original .eln to
avoid a similar problem.  Can't you use the same technique, to avoid
the need of rebasing on each start?  Please note that users could
place *.eln files in unusual locations (and customize
native-comp-eln-load-path to reflect that), so finding _all_ of the
relevant *.eln files from a shell script might not be easy.  In fact,
even without customizing the load-path, I don't think I understand how
will that script you propose know where to find all the *.eln files.

Thanks.




This bug report was last modified 3 years and 295 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.