summaryrefslogtreecommitdiffstats
path: root/sys/kern/imgact_elf.c
diff options
context:
space:
mode:
Diffstat (limited to 'sys/kern/imgact_elf.c')
-rw-r--r--sys/kern/imgact_elf.c25
1 files changed, 10 insertions, 15 deletions
diff --git a/sys/kern/imgact_elf.c b/sys/kern/imgact_elf.c
index af11111..699b59a 100644
--- a/sys/kern/imgact_elf.c
+++ b/sys/kern/imgact_elf.c
@@ -734,18 +734,20 @@ __CONCAT(exec_, __elfN(imgact))(struct image_params *imgp)
phdr[i].p_vaddr - seg_addr);
/*
- * Is this .text or .data? Use VM_PROT_WRITE
- * to distinguish between the two for the purpose
- * of limit checking and vmspace fields.
+ * Check whether the entry point is in this segment
+ * to determine whether to count is as text or data.
+ * XXX: this needs to be done better!
*/
- if (prot & VM_PROT_WRITE) {
+ if (hdr->e_entry >= phdr[i].p_vaddr &&
+ hdr->e_entry < (phdr[i].p_vaddr +
+ phdr[i].p_memsz)) {
+ text_size = seg_size;
+ text_addr = seg_addr;
+ entry = (u_long)hdr->e_entry;
+ } else {
data_size += seg_size;
if (data_addr == 0)
data_addr = seg_addr;
- } else {
- text_size += seg_size;
- if (text_addr == 0)
- text_addr = seg_addr;
}
/*
@@ -761,13 +763,6 @@ __CONCAT(exec_, __elfN(imgact))(struct image_params *imgp)
error = ENOMEM;
goto fail;
}
-
- /* Does the entry point belong to this segment? */
- if (hdr->e_entry >= phdr[i].p_vaddr &&
- hdr->e_entry < (phdr[i].p_vaddr +
- phdr[i].p_memsz)) {
- entry = (u_long)hdr->e_entry;
- }
break;
case PT_PHDR: /* Program header table info */
proghdr = phdr[i].p_vaddr;
OpenPOWER on IntegriCloud