summaryrefslogtreecommitdiff
path: root/mld/seg.c
diff options
context:
space:
mode:
authorFreya Murphy <freya@freyacat.org>2024-09-22 23:39:22 -0400
committerFreya Murphy <freya@freyacat.org>2024-09-22 23:39:22 -0400
commit49af3bfc627331f33efed10804db63687a1ddd7a (patch)
tree56267cbc61285bb60b03f0a6cab99902507283dc /mld/seg.c
parentmake mld file executable (diff)
downloadmips-49af3bfc627331f33efed10804db63687a1ddd7a.tar.gz
mips-49af3bfc627331f33efed10804db63687a1ddd7a.tar.bz2
mips-49af3bfc627331f33efed10804db63687a1ddd7a.zip
multitude of mld fixes, add entrypoint
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;
}