Guess where unknown functions are in .rel.plt
[centaur.git] / src / model / layout.c
index d5d49d874962ced66f5b7e5ded553f104df51d03..e4b3fb13aab028d93b4e24fecbc66a93fc17a3f7 100644 (file)
@@ -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) {