[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH 2/6] ELF refactor and consequent linker simplifications
From: |
Ludovic Courtès |
Subject: |
Re: [PATCH 2/6] ELF refactor and consequent linker simplifications |
Date: |
Wed, 22 May 2013 22:44:38 +0200 |
User-agent: |
Gnus/5.130007 (Ma Gnus v0.7) Emacs/24.3 (gnu/linux) |
Andy Wingo <address@hidden> 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’.