[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Guile-commits] 07/09: linker: Separate effectful part of 'add-elf-objec
From: |
Ludovic Courtès |
Subject: |
[Guile-commits] 07/09: linker: Separate effectful part of 'add-elf-objects'. |
Date: |
Sat, 7 Jan 2023 16:54:53 -0500 (EST) |
civodul pushed a commit to branch wip-linker-assembler-memory-consumption
in repository guile.
commit 8052758825f7d1d29aef038177ccd8cc2f758c76
Author: Ludovic Courtès <ludo@gnu.org>
AuthorDate: Fri Jan 6 17:18:14 2023 +0100
linker: Separate effectful part of 'add-elf-objects'.
* module/system/vm/linker.scm (add-elf-objects)[write-and-reloc]: Split
into...
[compute-reloc, write-object-elf-header!]: ... this.
Adjust accordingly.
---
module/system/vm/linker.scm | 20 +++++++++++++++-----
1 file changed, 15 insertions(+), 5 deletions(-)
diff --git a/module/system/vm/linker.scm b/module/system/vm/linker.scm
index ac1da6ecb..a618958f6 100644
--- a/module/system/vm/linker.scm
+++ b/module/system/vm/linker.scm
@@ -1,6 +1,6 @@
;;; Guile ELF linker
-;; Copyright (C) 2011, 2012, 2013, 2014, 2018 Free Software Foundation, Inc.
+;; Copyright (C) 2011, 2012, 2013, 2014, 2018, 2023 Free Software Foundation,
Inc.
;;;; This library is free software; you can redistribute it and/or
;;;; modify it under the terms of the GNU Lesser General Public
@@ -550,9 +550,8 @@ list of objects, augmented with objects for the special ELF
sections."
#:type SHT_PROGBITS
#:flags 0
#:size size)))
- (define (write-and-reloc section-label section relocs)
+ (define (compute-reloc section-label section relocs)
(let ((offset (* shentsize (elf-section-index section))))
- (write-elf-section-header bv offset endianness word-size section)
(if (= (elf-section-type section) SHT_NULL)
relocs
(let ((relocs
@@ -572,15 +571,26 @@ list of objects, augmented with objects for the special
ELF sections."
0
section-label)
relocs))))))
+
+ (define (write-object-elf-header! bv offset object)
+ (let ((section (linker-object-section object)))
+ (let ((offset (+ offset
+ (* shentsize (elf-section-index section)))))
+ (write-elf-section-header bv offset endianness word-size
section))))
+
+ (for-each (lambda (object)
+ (write-object-elf-header! bv 0 object))
+ objects)
+
(let ((relocs (fold-values
(lambda (object relocs)
- (write-and-reloc
+ (compute-reloc
(linker-symbol-name
(linker-object-section-symbol object))
(linker-object-section object)
relocs))
objects
- (write-and-reloc shoff-label section-table '()))))
+ (compute-reloc shoff-label section-table '()))))
(%make-linker-object #f section-table bv relocs
(list (make-linker-symbol shoff-label 0))))))
- [Guile-commits] branch wip-linker-assembler-memory-consumption created (now 2ac4e5a3d), Ludovic Courtès, 2023/01/07
- [Guile-commits] 02/09: assembler: Separate effectful part of 'link-symtab'., Ludovic Courtès, 2023/01/07
- [Guile-commits] 01/09: assembler: Separate 'process-relocs' from 'patch-relocs!'., Ludovic Courtès, 2023/01/07
- [Guile-commits] 03/09: assembler: Separate effectful part of 'link-dynamic-section'., Ludovic Courtès, 2023/01/07
- [Guile-commits] 04/09: assembler: Separate effectful part of 'link-procprops'., Ludovic Courtès, 2023/01/07
- [Guile-commits] 05/09: assembler: Separate effectful part of 'link-frame-maps'., Ludovic Courtès, 2023/01/07
- [Guile-commits] 07/09: linker: Separate effectful part of 'add-elf-objects'.,
Ludovic Courtès <=
- [Guile-commits] 06/09: assembler: Separate effectful part of 'link-docstrs'., Ludovic Courtès, 2023/01/07
- [Guile-commits] 08/09: DRAFT Add 'bytevector-slice'., Ludovic Courtès, 2023/01/07
- [Guile-commits] 09/09: linker, assembler: Avoid intermediate bytevectors., Ludovic Courtès, 2023/01/07