Andy Wingo <wi...@pobox.com> skribis: > * module/system/vm/elf.scm: Add commentary. > (make-elf): Add a constructor similar to make-elf-segment and > make-elf-section. > (write-elf32-header, write-elf64-header, write-elf-header): Take an > <elf> instead of all the fields separately. > (<elf-segment>, <elf-section>): Add "index" property. Adapt > constructors accordingly. > > * module/language/objcode/elf.scm (bytecode->elf): Arrange to set the > section indexes when creating ELF sections. > > * module/system/vm/linker.scm (alloc-segment, relocate-section-header): > Arrange to set segment and section indexes. > (find-shstrndx): New helper, replaces compute-sections-by-name. Now > that sections know their indexes, this is easier. > (allocate-elf, write-elf): New helpers, factored out of link-elf. > Easier now that sections have indexes. > (link-elf): Simplify. Check that the incoming objects have sensible > numbers. > > * test-suite/tests/linker.test: Update to set #:index on the linker > objects.
Looks good. > -(define (fold2 proc ls s0 s1) > - (let lp ((ls ls) (s0 s0) (s1 s1)) > - (if (null? ls) > - (values s0 s1) > - (receive (s0 s1) (proc (car ls) s0 s1) > - (lp (cdr ls) s0 s1))))) > - > (define (fold4 proc ls s0 s1 s2 s3) > (let lp ((ls ls) (s0 s0) (s1 s1) (s2 s2) (s3 s3)) > (if (null? ls) > @@ -236,15 +231,9 @@ > (receive (s0 s1 s2 s3) (proc (car ls) s0 s1 s2 s3) > (lp (cdr ls) s0 s1 s2 s3))))) > > -(define (fold5 proc ls s0 s1 s2 s3 s4) > - (let lp ((ls ls) (s0 s0) (s1 s1) (s2 s2) (s3 s3) (s4 s4)) > - (if (null? ls) > - (values s0 s1 s2 s3 s4) > - (receive (s0 s1 s2 s3 s4) (proc (car ls) s0 s1 s2 s3 s4) > - (lp (cdr ls) s0 s1 s2 s3 s4))))) What about moving these to a helper module eventually? Ludo’.