summaryrefslogtreecommitdiff
path: root/lisp/loadup.el
diff options
context:
space:
mode:
Diffstat (limited to 'lisp/loadup.el')
-rw-r--r--lisp/loadup.el34
1 files changed, 34 insertions, 0 deletions
diff --git a/lisp/loadup.el b/lisp/loadup.el
index 9cee6a2fd83..aefe91405cf 100644
--- a/lisp/loadup.el
+++ b/lisp/loadup.el
@@ -450,6 +450,34 @@ lost after dumping")))
;; At this point, we're ready to resume undo recording for scratch.
(buffer-enable-undo "*scratch*")
+(when (featurep 'nativecomp)
+ ;; Fix the compilation unit filename to have it working when
+ ;; when installed or if the source directory got moved. This is set to be
+ ;; a pair in the form: (rel-path-from-install-bin . rel-path-from-local-bin).
+ (let ((h (make-hash-table :test #'eq))
+ (bin-dest-dir (cadr (member "--bin-dest" command-line-args)))
+ (eln-dest-dir (cadr (member "--eln-dest" command-line-args))))
+ (when (and bin-dest-dir eln-dest-dir)
+ (setq eln-dest-dir
+ (concat eln-dest-dir "native-lisp/" comp-native-version-dir "/"))
+ (mapatoms (lambda (s)
+ (let ((f (symbol-function s)))
+ (when (subr-native-elisp-p f)
+ (puthash (subr-native-comp-unit f) nil h)))))
+ (maphash (lambda (cu _)
+ (native-comp-unit-set-file
+ cu
+ (cons
+ ;; Relative path from the installed binary.
+ (file-relative-name (concat eln-dest-dir
+ (file-name-nondirectory
+ (native-comp-unit-file cu)))
+ bin-dest-dir)
+ ;; Relative path from the built uninstalled binary.
+ (file-relative-name (native-comp-unit-file cu)
+ invocation-directory))))
+ h))))
+
(when (hash-table-p purify-flag)
(let ((strings 0)
(vectors 0)
@@ -483,6 +511,11 @@ lost after dumping")))
((equal dump-mode "bootstrap") "emacs")
((equal dump-mode "pbootstrap") "bootstrap-emacs.pdmp")
(t (error "unrecognized dump mode %s" dump-mode)))))
+ (when (and (featurep 'nativecomp)
+ (equal dump-mode "pdump"))
+ ;; Don't enable this before bootstrap is completed the as the
+ ;; compiler infrastructure may not be usable.
+ (setq comp-enable-subr-trampolines t))
(message "Dumping under the name %s" output)
(condition-case ()
(delete-file output)
@@ -539,6 +572,7 @@ lost after dumping")))
;; Don't keep `load-file-name' set during the top-level session!
;; Otherwise, it breaks a lot of code which does things like
;; (or load-file-name byte-compile-current-file).
+(setq load-true-file-name nil)
(setq load-file-name nil)
(eval top-level)