diff options
Diffstat (limited to 'mld')
-rw-r--r-- | mld/link.c | 4 | ||||
-rw-r--r-- | mld/link.h | 2 | ||||
-rw-r--r-- | mld/obj.c | 29 |
3 files changed, 4 insertions, 31 deletions
@@ -8,9 +8,9 @@ #include <sys/stat.h> #include <melf.h> #include <fcntl.h> +#include <mips32.h> #include "link.h" -#include "mips.h" static int load_objects(struct linker *linker) { @@ -443,7 +443,7 @@ static int relocate_instruction_rela(struct linker *linker, uint32_t sym_vaddr = B32(new_sym->st_value); uint32_t *ins_raw = (uint32_t *) &seg->bytes[off]; - union mips_instruction_data ins; + union mips32_instruction ins; ins.raw = B32(*ins_raw); uint32_t ins_vaddr = seg->new_vaddr + off; @@ -5,7 +5,6 @@ #include <linux/limits.h> #include <mlimits.h> -#include <mips.h> #include <merror.h> #include <stdint.h> #include <elf.h> @@ -224,7 +223,6 @@ struct object { // program table Elf32_Phdr *phdr; size_t phdr_len; - bool phdr_local; // if phdr was created though malloc // phdr <=> shdr mappings uint32_t *phdr_to_shdr_mapping; @@ -105,7 +105,6 @@ static int create_phdr(struct object *object) object->phdr = phdr; object->phdr_len = entries; - object->phdr_local = true; uint32_t *mapping = malloc(entries * sizeof(uint32_t)); if (mapping == NULL) { @@ -149,29 +148,6 @@ static int create_phdr(struct object *object) } /** - * Map the phdr - */ -static int load_phdr(struct object *object) -{ - //size_t phdr_len = B16(object->ehdr->e_phentsize) * - // B16(object->ehdr->e_phnum); - - //if (phdr_len < 1) - return create_phdr(object); - - //size_t phdr_off = B32(object->ehdr->e_phoff); - //object->phdr = (Elf32_Phdr *) (object->mapped + phdr_off); - //object->phdr_len = B16(object->ehdr->e_phnum); - - //if (BOUND_CHK(object, phdr_len, phdr_off)) { - // ERROR("cannot read phdr"); - // return M_ERROR; - //} - - //return M_SUCCESS; -} - -/** * Load the strtabs */ static int load_strtabs(struct object *object) @@ -358,7 +334,6 @@ int object_load(struct object *object, char *path, uint32_t index) object->mapped = NULL; object->name = path; object->index = index; - object->phdr_local = false; object->phdr_to_shdr_mapping = NULL; /** load the file */ @@ -374,7 +349,7 @@ int object_load(struct object *object, char *path, uint32_t index) return M_ERROR; /* phdr */ - if (load_phdr(object)) + if (create_phdr(object)) return M_ERROR; /* strtabs */ @@ -404,7 +379,7 @@ void object_free(struct object *obj) free(obj->strtabs); if (obj->segments != NULL) free(obj->segments); - if (obj->phdr_local) + if (obj->phdr != NULL) free(obj->phdr); if (obj->phdr_to_shdr_mapping) free(obj->phdr_to_shdr_mapping); |