summaryrefslogtreecommitdiff
path: root/module/system
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2024-04-15 15:58:30 +0200
committerLudovic Courtès <ludo@gnu.org>2024-04-15 19:58:25 +0200
commit4a0c2433d97be9d995b3be74d90bc074d8efb5a7 (patch)
treea2448baa9c6d9b5c13feff5bad72c8fc89cc8206 /module/system
parent6495b4d578116aeadf9f4156364431609f42275f (diff)
downloadguile-4a0c2433d97be9d995b3be74d90bc074d8efb5a7.tar.gz
linker: Create sparse files for padding.
Since ‘*lcm-page-size*’ is 64 KiB, this saves disk space for small ‘.go’ files. * module/system/vm/linker.scm (link-elf)[write-padding]: Rewrite in terms of ‘seek’.
Diffstat (limited to 'module/system')
-rw-r--r--module/system/vm/linker.scm14
1 files changed, 4 insertions, 10 deletions
diff --git a/module/system/vm/linker.scm b/module/system/vm/linker.scm
index cf213323e..952e85c30 100644
--- a/module/system/vm/linker.scm
+++ b/module/system/vm/linker.scm
@@ -769,16 +769,10 @@ Returns a bytevector."
objects)
bv)
(lambda (port)
- (define write-padding
- (let ((blank (make-bytevector 4096 0)))
- (lambda (port size)
- ;; Write SIZE bytes of padding to PORT.
- (let loop ((size size))
- (unless (zero? size)
- (let ((count (min size
- (bytevector-length blank))))
- (put-bytevector port blank 0 count)
- (loop (- size count))))))))
+ (define (write-padding port size)
+ ;; Write SIZE bytes of padding to PORT. Use 'seek' to
+ ;; create a sparse file.
+ (seek port size SEEK_CUR))
(define (compute-padding objects)
;; Return the list of padding in between OBJECTS--the list