From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Andy Moreton Newsgroups: gmane.emacs.bugs Subject: bug#46256: [feature/native-comp] AOT eln files ignored if run from build tree Date: Sat, 06 Mar 2021 01:47:09 +0000 Message-ID: <86sg593vfm.fsf@gmail.com> References: <861rd1tbpa.fsf@gmail.com> <83pn0km6y3.fsf@gnu.org> <86ft1f8ara.fsf@gmail.com> <83sg5cjdn8.fsf@gnu.org> <83r1kwjcy2.fsf@gnu.org> <83k0qoj9zv.fsf@gnu.org> <83im68j963.fsf@gnu.org> <83tuprhur0.fsf@gnu.org> <831rcu25o2.fsf@gnu.org> <83v9a6zr22.fsf@gnu.org> <83o8fyzjrz.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="18123"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (windows-nt) To: 46256@debbugs.gnu.org Cancel-Lock: sha1:jFQWwWBsna50qTkzzQhCDiTZbTw= Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat Mar 06 02:48:11 2021 Return-path: Envelope-to: geb-bug-gnu-emacs@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 1lIM38-0004bs-6v for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 06 Mar 2021 02:48:10 +0100 Original-Received: from localhost ([::1]:41862 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lIM37-0007hC-97 for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 05 Mar 2021 20:48:09 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:52926) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lIM31-0007h1-MK for bug-gnu-emacs@gnu.org; Fri, 05 Mar 2021 20:48:03 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:52465) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lIM30-0002m4-4b for bug-gnu-emacs@gnu.org; Fri, 05 Mar 2021 20:48:03 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1lIM30-0002m4-24 for bug-gnu-emacs@gnu.org; Fri, 05 Mar 2021 20:48:02 -0500 X-Loop: help-debbugs@gnu.org In-Reply-To: Resent-From: Andy Moreton Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 06 Mar 2021 01:48:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 46256 X-GNU-PR-Package: emacs X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.161499526110637 (code B ref -1); Sat, 06 Mar 2021 01:48:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 6 Mar 2021 01:47:41 +0000 Original-Received: from localhost ([127.0.0.1]:35778 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lIM2U-0002lM-EC for submit@debbugs.gnu.org; Fri, 05 Mar 2021 20:47:41 -0500 Original-Received: from lists.gnu.org ([209.51.188.17]:43456) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lIM2S-0002lD-N6 for submit@debbugs.gnu.org; Fri, 05 Mar 2021 20:47:29 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:52872) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lIM2S-0007dY-FQ for bug-gnu-emacs@gnu.org; Fri, 05 Mar 2021 20:47:28 -0500 Original-Received: from ciao.gmane.io ([116.202.254.214]:50236) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lIM2Q-0002ZW-Uz for bug-gnu-emacs@gnu.org; Fri, 05 Mar 2021 20:47:28 -0500 Original-Received: from list by ciao.gmane.io with local (Exim 4.92) (envelope-from ) id 1lIM2K-0003iQ-Sr for bug-gnu-emacs@gnu.org; Sat, 06 Mar 2021 02:47:20 +0100 X-Injected-Via-Gmane: http://gmane.org/ Received-SPF: pass client-ip=116.202.254.214; envelope-from=geb-bug-gnu-emacs@m.gmane-mx.org; helo=ciao.gmane.io X-Spam_score_int: 5 X-Spam_score: 0.5 X-Spam_bar: / X-Spam_report: (0.5 / 5.0 requ) BAYES_00=-1.9, DKIM_ADSP_CUSTOM_MED=0.001, FORGED_GMAIL_RCVD=1, FREEMAIL_FORGED_FROMDOMAIN=0.25, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.249, NML_ADSP_CUSTOM_MED=0.9, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:201588 Archived-At: On Fri 05 Mar 2021, Andrea Corallo via "Bug reports for GNU Emacs, the Swiss army knife of text editors" wrote: > Pip Cet writes: > >> On Fri, Mar 5, 2021 at 9:33 AM Andrea Corallo via Bug reports for GNU >> Emacs, the Swiss army knife of text editors >> wrote: >>> Eli Zaretskii writes: >>> > So currently the only way to fill up a newly created subdirectory of >>> > native-lisp/ is to manually delete the *.elc files of all the files in >>> > lisp.mk's $shortlisp list, is that sufficient? >>> >>> Yes I think so. >>> >>> The trouble of using make for building such a system is that make is not >>> aware of the .eln filename, so it should be necessary to ask the Emacs >>> binary about that to create dynamically the precise (multiple target) >>> rule. Not very practical IMO... >> >> I do wonder whether the whole filename scheme is really the best option. >> >> IIUC, and that's a big if in this case, the main motivation for using >> hashes in the .eln filenames is that dlopen() is broken and may return >> the same handle for subsequent dlopen()s of the same name, even if the >> underlying file changed in between. > > Unfortunately this was only an unfortunate discover along the road... > this design predates that. Can you explain what the problem is with dlopen ? I have not found a complete and precise description of the problem in earlier messages as a reproducer. Is the problem that dlopen resolves to use an unlinked file kept alive by having open handles, rather than a new file with the filename used by the old file before it was unlinked ? >> Merely verifying that the ABI is correct could be done at runtime, so >> that's no reason to keep a hash in the filename. >> >> So my vague idea is this: >> >> 1. implement fixed_dlopen(), which keeps track of filenames that have >> been opened and, if necessary, creates a temporary file and loads that >> instead of its argument. >> 2. compile lisp/emacs-lisp/bytecomp.el to lisp/emacs-lisp/bytecomp.elc >> and native-lisp/emacs-lisp/bytecomp.eln > > So it was at the beginning, I think we moved away from that before the > odd dlopen behavior. As above, this odd dlopen behaviour needs to be fully explained to ensure that design choices are not driven by possible misunderstandings. >> 3. add extra code in the top level function of each .eln to check that >> the ABI is correct. >> >> This would allow us to use standard make rules. It would also make >> .eln filenames predictable. It might even draw someone's attention to >> the fact that dlopen() is broken and make them fix it. >> >> I'm probably missing other good reasons for the hashed filename scheme. > > Yep, this was discussed in length on emacs-devel, IIRC mainly on a long > standing thread called "native compilation the bird-eye view" (or > something close). Thread "Native compilation: the bird-eye view" starts here: https://lists.gnu.org/archive/html/emacs-devel/2020-05/msg02186.html I agree with Pip that using standard make rules eases several development pains and should be used if at all possible. AndyM