aboutsummaryrefslogtreecommitdiffstats
path: root/src/space.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/space.c')
-rw-r--r--src/space.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/space.c b/src/space.c
index 7ceb131..bf76a41 100644
--- a/src/space.c
+++ b/src/space.c
@@ -635,6 +635,13 @@ find_readonly_space (DSO *dso, GElf_Shdr *add, GElf_Ehdr *ehdr,
for (i = 0, j = 0; i < ehdr->e_phnum; ++i)
if (phdr[i].p_type == PT_LOAD)
j = i;
+ else if (phdr[i].p_type == PT_PHDR)
+ {
+ if (phdr[i].p_filesz == ehdr->e_phnum * ehdr->e_phentsize)
+ phdr[i].p_filesz += ehdr->e_phentsize;
+ if (phdr[i].p_memsz == ehdr->e_phnum * ehdr->e_phentsize)
+ phdr[i].p_memsz += ehdr->e_phentsize;
+ }
memmove (&phdr[j + 2], &phdr[j + 1],
(ehdr->e_phnum - j - 1) * sizeof (GElf_Phdr));