Changeset 57d44dd in mainline for kernel/generic/src/lib/elf.c
- Timestamp:
- 2018-04-10T18:51:14Z (6 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 20287223
- Parents:
- e3f819f
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/generic/src/lib/elf.c
re3f819f r57d44dd 46 46 #include <macros.h> 47 47 #include <arch.h> 48 #include <str.h> 48 49 49 50 #include <lib/elf_load.h> … … 58 59 }; 59 60 60 static int segment_header(elf_segment_header_t *, elf_header_t *, as_t *,61 unsigned int);62 61 static int load_segment(elf_segment_header_t *, elf_header_t *, as_t *); 63 62 … … 71 70 * 72 71 */ 73 unsigned int elf_load(elf_header_t *header, as_t *as , unsigned int flags)72 unsigned int elf_load(elf_header_t *header, as_t *as) 74 73 { 75 74 /* Identify ELF */ … … 106 105 header->e_phoff))[i]; 107 106 108 int rc = segment_header(seghdr, header, as, flags); 107 if (seghdr->p_type != PT_LOAD) 108 continue; 109 110 int rc = load_segment(seghdr, header, as); 109 111 if (rc != EE_OK) 110 112 return rc; … … 126 128 127 129 return error_codes[rc]; 128 }129 130 /** Process segment header.131 *132 * @param entry Segment header.133 * @param elf ELF header.134 * @param as Address space into wich the ELF is being loaded.135 *136 * @return EE_OK on success, error code otherwise.137 *138 */139 static int segment_header(elf_segment_header_t *entry, elf_header_t *elf,140 as_t *as, unsigned int flags)141 {142 switch (entry->p_type) {143 case PT_NULL:144 case PT_PHDR:145 case PT_NOTE:146 break;147 case PT_LOAD:148 return load_segment(entry, elf, as);149 case PT_TLS:150 break;151 case PT_DYNAMIC:152 case PT_INTERP:153 // FIXME154 /*155 char *interp = (char *) elf + entry->p_offset;156 if (memcmp((uintptr_t) interp, (uintptr_t) ELF_INTERP_ZSTR,157 ELF_INTERP_ZLEN) != 0) {158 return EE_UNSUPPORTED;159 } */160 if ((flags & ELD_F_LOADER) == 0)161 return EE_LOADER;162 break;163 case PT_SHLIB:164 case PT_LOPROC:165 case PT_HIPROC:166 default:167 return EE_UNSUPPORTED;168 }169 return EE_OK;170 130 } 171 131
Note:
See TracChangeset
for help on using the changeset viewer.