summaryrefslogtreecommitdiff
path: root/mld/seg.c
diff options
context:
space:
mode:
Diffstat (limited to 'mld/seg.c')
-rw-r--r--mld/seg.c9
1 files changed, 2 insertions, 7 deletions
diff --git a/mld/seg.c b/mld/seg.c
index ba14cf9..61c5296 100644
--- a/mld/seg.c
+++ b/mld/seg.c
@@ -31,10 +31,9 @@ static int load_shdr(struct object *obj, struct segment *seg, size_t index)
Elf32_Shdr *hdr = &obj->shdr[i];
// find shdr that matches the offset in phdr
- if (seg->phdr->p_offset != hdr->sh_offset)
+ if (!PHDR_SHDR_MATCH(seg->phdr, hdr))
continue;
-
// get name
uint32_t name = B32(hdr->sh_name);
if (name >= obj->shstrtab->len) {
@@ -43,11 +42,6 @@ static int load_shdr(struct object *obj, struct segment *seg, size_t index)
}
seg->name = &obj->shstrtab->data[name];
- if (seg->phdr->p_filesz != hdr->sh_size) {
- ERROR("segment phdr and shdr file sizes to not match");
- return M_ERROR;
- }
-
// map bytes
uint32_t len = B32(hdr->sh_size);
uint32_t off = B32(hdr->sh_offset);
@@ -154,6 +148,7 @@ int segment_load(struct object *obj, struct segment *seg, size_t index)
seg->align = B32(seg->phdr->p_align);
seg->obj = obj;
+ seg->ent = NULL;
return M_SUCCESS;
}