summaryrefslogtreecommitdiff
path: root/src/model/layout.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/model/layout.c')
-rw-r--r--src/model/layout.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/model/layout.c b/src/model/layout.c
index d5d49d8..e4b3fb1 100644
--- a/src/model/layout.c
+++ b/src/model/layout.c
@@ -82,6 +82,12 @@ GElf_Addr elfu_mLayoutGetSpaceInPhdr(ElfuElf *me, GElf_Word size,
assert(!(w && x));
+ /* Treat read-only data as executable.
+ * That's what the GNU toolchain does on x86. */
+ if (!w && !x) {
+ x = 1;
+ }
+
/* Find first and last LOAD PHDRs.
* Don't compare p_memsz - segments don't overlap in memory. */
CIRCLEQ_FOREACH(mp, &me->phdrList, elem) {