This goes beyond my ELF capabilities, so can’t really comment on this. Style comments:
Andy Wingo <wi...@pobox.com> skribis: > * module/system/vm/linker.scm (make-linker-object): > (linker-object-section-symbol): > (linker-object-symbols*): Create a symbol to the start of a linker > object. Hide it from the external linker-object-symbols* accessor. > > (segment-kind, count-segments): Sections without SHF_ALLOC don't get > segments. > (collate-objects-into-segments): Allow for #f segment types. If two > sections have the same type and flags, leave them in the same order. > > (align): Allow for 0 alignment. > > (add-elf-objects): New helper: puts the ELF data structures (header, > segment table, and section table) in sections of their own. This > lends a nice clarity and conceptual unity to the linker. Please move the descriptions as docstrings. > (relocate-section-header, alloc-objects): Lay out segments with > congruent, contiguous addresses, so that we can just mmap the file and > if debugging sections that are not in segments are present, they can > be lazily paged in if needed by the kernel's VM system. Nice. Could you move this comment in the code? > ;; objects ::= list of <linker-object> > -;; => 3 values: ELF header, program headers, objects > +;; > +;; => 3 values: > +;; file size > +;; objects with allocated memory address and file offset > +;; symbol table > +;; > (define (allocate-elf objects page-aligned? endianness word-size) What does it do? Ludo’.