[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
feature/native-comp f4156b4 3/7: Implement position independent dump.
From: |
Andrea Corallo |
Subject: |
feature/native-comp f4156b4 3/7: Implement position independent dump. |
Date: |
Sun, 12 Apr 2020 12:13:38 -0400 (EDT) |
branch: feature/native-comp
commit f4156b452fd45ed4a706a2083755212c16ef88bb
Author: Andrea Corallo <address@hidden>
Commit: Andrea Corallo <address@hidden>
Implement position independent dump.
Set the filename for every compilation unit as realtive to obtain a
position independent dump.
* lisp/loadup.el: Modify filename for every compilation unit as
position independent.
* src/pdumper.c (dump_do_dump_relocation): Update to be invocation
directory relative.
---
lisp/loadup.el | 15 +++++++++++++++
src/pdumper.c | 3 ++-
2 files changed, 17 insertions(+), 1 deletion(-)
diff --git a/lisp/loadup.el b/lisp/loadup.el
index 97525b2..bda9919 100644
--- a/lisp/loadup.el
+++ b/lisp/loadup.el
@@ -449,6 +449,21 @@ lost after dumping")))
;; At this point, we're ready to resume undo recording for scratch.
(buffer-enable-undo "*scratch*")
+(when (boundp 'comp-ctxt) ; FIXME better native-comp build discriminant?
+ ;; Set the filename for every compilation unit as realtive
+ ;; to obtain a position independent dump.
+ (let ((h (make-hash-table :test #'eq)))
+ (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
+ (file-relative-name (native-comp-unit-file cu)
+ invocation-directory)))
+ h)))
+
(when (hash-table-p purify-flag)
(let ((strings 0)
(vectors 0)
diff --git a/src/pdumper.c b/src/pdumper.c
index 03c3168..7fbacfe 100644
--- a/src/pdumper.c
+++ b/src/pdumper.c
@@ -5298,7 +5298,8 @@ dump_do_dump_relocation (const uintptr_t dump_base,
{
struct Lisp_Native_Comp_Unit *comp_u =
dump_ptr (dump_base, reloc_offset);
- comp_u->handle = dynlib_open (SSDATA (comp_u->file));
+ comp_u->handle =
+ dynlib_open (SSDATA (concat2 (Vinvocation_directory, comp_u->file)));
if (!comp_u->handle)
error ("%s", dynlib_error ());
load_comp_unit (comp_u, true, false);
- feature/native-comp updated (4abb8c8 -> f9a1d4b), Andrea Corallo, 2020/04/12
- feature/native-comp d85b803 2/7: * src/comp.c (native-comp-unit-set-file): New function., Andrea Corallo, 2020/04/12
- feature/native-comp 62f9569 1/7: * src/comp.c (native-comp-unit-file): Better parameter name., Andrea Corallo, 2020/04/12
- feature/native-comp f4156b4 3/7: Implement position independent dump.,
Andrea Corallo <=
- feature/native-comp 3dd6cf8 5/7: Implement working make install for native build., Andrea Corallo, 2020/04/12
- feature/native-comp b56de5d 6/7: * src/pdumper.c (dump_do_dump_relocation): Optimize native dump load., Andrea Corallo, 2020/04/12
- feature/native-comp 7f5d1e9 4/7: Set invocation variables during dump load., Andrea Corallo, 2020/04/12
- feature/native-comp f9a1d4b 7/7: Merge remote-tracking branch 'savannah/master' into HEAD, Andrea Corallo, 2020/04/12