diff options
author | Andy Wingo <wingo@pobox.com> | 2014-02-17 14:15:30 +0100 |
---|---|---|
committer | Andy Wingo <wingo@pobox.com> | 2014-02-17 14:15:34 +0100 |
commit | 26c19d79d90d3b3bdb05db2aa592869db55a3fba (patch) | |
tree | b1d3e8ce8c45ad8c55e0beecc83596900f3ef3db /libguile/loader.c | |
parent | 3c08b6c1b2a8c51c3ea281c047fbbdae95bc5494 (diff) | |
download | guile-26c19d79d90d3b3bdb05db2aa592869db55a3fba.tar.gz |
PT_DYNAMIC inside some other PT_LOAD segment
* libguile/loader.c (load_thunk_from_memory): Only load PT_LOAD
segments, as libc does. The PT_DYNAMIC segment should be inside some
other PT_LOAD segment.
* module/system/vm/linker.scm (segment-kind): Give the .dynamic segment
PT_LOAD kind, so that it is written in a PT_LOAD segment.
(count-segments): Add one if there is a SHT_DYNAMIC segment.
(allocate-segment): Set the paddr to the addr, as binutils do.
(record-special-segments): New routine, to write out special segments
like PT_DYNAMIC.
(allocate-elf): Call record-special-segments.
Diffstat (limited to 'libguile/loader.c')
-rw-r--r-- | libguile/loader.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/libguile/loader.c b/libguile/loader.c index 83c5bb56c..a55bd15b0 100644 --- a/libguile/loader.c +++ b/libguile/loader.c @@ -392,8 +392,12 @@ load_thunk_from_memory (char *data, size_t len, int is_read_only) if (dynamic_segment >= 0) ABORT ("expected only one PT_DYNAMIC segment"); dynamic_segment = i; + continue; } + if (ph[i].p_type != PT_LOAD) + ABORT ("unknown segment type"); + if (i == 0) { if (ph[i].p_vaddr != 0) @@ -421,6 +425,8 @@ load_thunk_from_memory (char *data, size_t len, int is_read_only) #ifdef HAVE_SYS_MMAN_H for (i = 0; i < n; i++) { + if (ph[i].p_type != PT_LOAD) + continue; if (ph[i].p_flags == PF_R) continue; if (ph[i].p_align != 4096) |