refactor and simplify ELF loader in objcodes.c
authorAndy Wingo <wingo@pobox.com>
Sun, 28 Apr 2013 12:23:20 +0000 (14:23 +0200)
committerAndy Wingo <wingo@pobox.com>
Thu, 23 May 2013 12:19:06 +0000 (14:19 +0200)
commite1aee492d7e419b590d627bd70459b90700187ae
treee8a374a7a5eb526d8106e047465091d69ce53340
parent0b3b73698c92081ad3c24f40203d8f34e82778a3
refactor and simplify ELF loader in objcodes.c

* libguile/objcodes.c (sniff_elf_alignment, alloc_aligned)
  (copy_and_align_elf_data): New helpers for portably re-aligning ELF
  data from read(2) or from a bytevector.
  (load_thunk_from_memory): Simplify!  Now there is only one procedure
  that loads ELF, and it does less: it simply receives the whole image
  in one array, hopefully from mmap.

  (scm_load_thunk_from_file): Use new map_file_contents helper, and go
  through load_thunk_from_memory.
  (scm_load_thunk_from_memory): Pass load_thunk_from_memory a piece of
  memory that it owns, and that is appropriately aligned.
libguile/objcodes.c