Lines Matching refs:ElfHandle

35 extern u16 ELi_LoadObject2( ELHandle* ElfHandle, void* obj_offset, void* buf);
48 u16 ELi_LoadLibrary( ELHandle* ElfHandle, void* obj_image, u32 obj_len, void* buf, u16 type);
50 u16 ELi_LoadObject( ELHandle* ElfHandle, void* obj_offset, void* buf);
113 BOOL EL_InitHandle( ELHandle* ElfHandle) in EL_InitHandle() argument
115 if( ElfHandle == NULL) { /*NULL check*/ in EL_InitHandle()
120 ElfHandle->ShdrEx = NULL; in EL_InitHandle()
121 ElfHandle->SymEx = NULL; in EL_InitHandle()
122 ElfHandle->SymExTbl = NULL; in EL_InitHandle()
123 ElfHandle->SymExTarget = 0xFFFFFFFF; in EL_InitHandle()
125 ElfHandle->process = EL_INITIALIZED; /*Set the flag*/ in EL_InitHandle()
138 u16 EL_LoadLibraryfromFile( ELHandle* ElfHandle, FILE* ObjFile, void* buf, u16 type) in EL_LoadLibraryfromFile() argument
144 ElfHandle->ELi_ReadStub = ELi_ReadFile; in EL_LoadLibraryfromFile()
145 ElfHandle->FileStruct = ObjFile; in EL_LoadLibraryfromFile()
150 result = ELi_LoadLibrary( ElfHandle, NULL, len, buf, type); in EL_LoadLibraryfromFile()
162 u16 EL_LoadLibraryfromMem( ELHandle* ElfHandle, void* obj_image, u32 obj_len, void* buf) in EL_LoadLibraryfromMem() argument
167 ElfHandle->ELi_ReadStub = ELi_ReadMem; in EL_LoadLibraryfromMem()
168 ElfHandle->FileStruct = NULL; in EL_LoadLibraryfromMem()
170 result = ELi_LoadLibrary( ElfHandle, obj_image, obj_len, buf, 0); in EL_LoadLibraryfromMem()
182 u16 ELi_LoadLibrary( ELHandle* ElfHandle, void* obj_image, u32 obj_len, void* buf, u16 type) in ELi_LoadLibrary() argument
196 ElfHandle->ar_head = obj_image; in ELi_LoadLibrary()
200ElfHandle->ELi_ReadStub( OBJMAG, ElfHandle->FileStruct, (u32)obj_image, 0, 8); /*Get the OBJ ch… in ELi_LoadLibrary()
213 ElfHandle->buf_current = (void*)new_image_pointer; in ELi_LoadLibrary()
215ElfHandle->ELi_ReadStub( &ArHdr, ElfHandle->FileStruct, (u32)(obj_image), image_pointer, arch_size… in ELi_LoadLibrary()
216ElfHandle->ELi_ReadStub( OBJMAG, ElfHandle->FileStruct, (u32)(obj_image), (image_pointer+arch_size… in ELi_LoadLibrary()
223 result = ELi_LoadObject( ElfHandle, (void*)(image_pointer+arch_size), in ELi_LoadLibrary()
227 result = ELi_LoadObject2( ElfHandle, (void*)(image_pointer+arch_size), in ELi_LoadLibrary()
231 …ELi_SetDecSize( (char*)(((ArchHdr*)new_image_pointer)->ar_size), ElfHandle->newelf_size); //Update… in ELi_LoadLibrary()
232 new_image_pointer += (ElfHandle->newelf_size + arch_size); in ELi_LoadLibrary()
233 newarch_size += (ElfHandle->newelf_size + arch_size); in ELi_LoadLibrary()
239 ElfHandle->ShdrEx = NULL; in ELi_LoadLibrary()
240 ElfHandle->SymEx = NULL; in ELi_LoadLibrary()
241 ElfHandle->process = EL_INITIALIZED; /*Set the flag*/ in ELi_LoadLibrary()
246ElfHandle->ELi_ReadStub( (void*)(new_image_pointer+arch_size), ElfHandle->FileStruct, in ELi_LoadLibrary()
256 ElfHandle->newelf_size = newarch_size; in ELi_LoadLibrary()
261 all_result = ELi_LoadObject( ElfHandle, 0, buf); in ELi_LoadLibrary()
263 all_result = ELi_LoadObject2( ElfHandle, 0, buf); in ELi_LoadLibrary()
283 u16 ELi_LoadObject( ELHandle* ElfHandle, void* obj_offset, void* buf) in ELi_LoadObject() argument
303 if( ElfHandle->process != EL_INITIALIZED) { in ELi_LoadObject()
311 ElfHandle->ELi_ReadStub( &(ElfHandle->CurrentEhdr), ElfHandle->FileStruct, in ELi_LoadObject()
312 (u32)(ElfHandle->ar_head), (u32)(obj_offset), sizeof( Elf32_Ehdr)); in ELi_LoadObject()
315 ElfHandle->elf_offset = obj_offset; in ELi_LoadObject()
316 ElfHandle->buf_current = (void*)((u32)buf + sizeof( Elf32_Ehdr)); in ELi_LoadObject()
317 ElfHandle->shentsize = ElfHandle->CurrentEhdr.e_shentsize; in ELi_LoadObject()
320 shdr_table = (u32*)malloc( 4 * ElfHandle->CurrentEhdr.e_shnum); in ELi_LoadObject()
324 for( i=0; i<(ElfHandle->CurrentEhdr.e_shnum); i++) { in ELi_LoadObject()
330 if( ELi_ShdrIsDebug( ElfHandle, i) == TRUE) { /*When it is debugging information*/ in ELi_LoadObject()
335 ELi_GetShdr( ElfHandle, i, &(CurrentShdrEx->Shdr)); in ELi_LoadObject()
343 ELi_GetStrAdr( ElfHandle, ElfHandle->CurrentEhdr.e_shstrndx, in ELi_LoadObject()
350 …length = ELi_GetStrLen( ElfHandle, ElfHandle->CurrentEhdr.e_shstrndx, CurrentShdrEx->Shdr.sh_name)… in ELi_LoadObject()
357 ELi_GetStrAdr( ElfHandle, ElfHandle->CurrentEhdr.e_shstrndx, in ELi_LoadObject()
366 ElfHandle->CurrentEhdr.e_shnum++; //Add special section in ELi_LoadObject()
392 ElfHandle->ShdrEx = DmyShdrEx.next; in ELi_LoadObject()
398 for( i=0; i<(ElfHandle->CurrentEhdr.e_shnum); i++) { in ELi_LoadObject()
400 CurrentShdrEx = ELi_GetShdrExfromList( ElfHandle->ShdrEx, i); in ELi_LoadObject()
410 ELi_CopySectionToBuffer( ElfHandle, &(CurrentShdrEx->Shdr)); in ELi_LoadObject()
423 CurrentShdrEx->loaded_adr = ELi_ALIGN( (u32)(ElfHandle->buf_current), 4); in ELi_LoadObject()
437 u32 load_start = ELi_ALIGN( ((u32)(ElfHandle->buf_current)), 4); in ELi_LoadObject()
441 for( j=0; j<(ElfHandle->CurrentEhdr.e_shnum - 1); j++) { in ELi_LoadObject()
449 ElfHandle->buf_current = (void*)(load_start + sh_size); in ELi_LoadObject()
456 ELi_CopySectionToBuffer( ElfHandle, &(CurrentShdrEx->Shdr)); in ELi_LoadObject()
460 ELi_BuildSymList( ElfHandle, i, &(CurrentShdrEx->sym_table)); //Create symbol list in ELi_LoadObject()
472 CurrentSymEx = ElfHandle->SymEx; in ELi_LoadObject()
475 StrShEx = ELi_GetShdrExfromList( ElfHandle->ShdrEx, in ELi_LoadObject()
479 ELi_GetStrAdr( ElfHandle, CurrentShdrEx->Shdr.sh_link, //Get symbol string in ELi_LoadObject()
486 … length = ELi_GetStrLen( ElfHandle, CurrentShdrEx->Shdr.sh_link, CurrentSymEx->Sym.st_name ) + 1; in ELi_LoadObject()
493 ELi_GetStrAdr( ElfHandle, CurrentShdrEx->Shdr.sh_link, in ELi_LoadObject()
531 CurrentShdrEx->loaded_adr = (u32)(ELi_CopySymToBuffer( ElfHandle)); in ELi_LoadObject()
540 … ELi_FreeSymList( ElfHandle, (u32**)(CurrentShdrEx->sym_table)); //Deallocate the symbol list in ELi_LoadObject()
549 for( i=0; i<(ElfHandle->CurrentEhdr.e_shnum); i++) { in ELi_LoadObject()
551 CurrentShdrEx = ELi_GetShdrExfromList( ElfHandle->ShdrEx, i); in ELi_LoadObject()
558 ELi_CopySectionToBuffer( ElfHandle, &(CurrentShdrEx->Shdr)); in ELi_LoadObject()
564 SymShdrEx = ELi_GetShdrExfromList( ElfHandle->ShdrEx, in ELi_LoadObject()
578 ELi_CopySectionToBuffer( ElfHandle, &(CurrentShdrEx->Shdr)); in ELi_LoadObject()
584 SymShdrEx = ELi_GetShdrExfromList( ElfHandle->ShdrEx, in ELi_LoadObject()
599 if( i == ElfHandle->CurrentEhdr.e_shstrndx) { //Section name string table section in ELi_LoadObject()
601 ELi_CopyShStrToBuffer( ElfHandle, &(CurrentShdrEx->Shdr)); in ELi_LoadObject()
604 ELi_CopySymStrToBuffer( ElfHandle, CurrentShdrEx); in ELi_LoadObject()
617 buf_shdr = ELi_ALIGN( ((u32)(ElfHandle->buf_current)), 4); in ELi_LoadObject()
618 ElfHandle->buf_current = (void*)buf_shdr; in ELi_LoadObject()
626 for( i=0; i<(ElfHandle->CurrentEhdr.e_shnum); i++) { in ELi_LoadObject()
630 CurrentShdrEx = ELi_GetShdrExfromList( ElfHandle->ShdrEx, i); in ELi_LoadObject()
654 ElfHandle->process = EL_COPIED; in ELi_LoadObject()
657 ElfHandle->newelf_size = (buf_shdr - (u32)buf) + (section_num*sizeof( Elf32_Shdr)); in ELi_LoadObject()
661ElfHandle->CurrentEhdr.e_shnum = section_num; /*Apply the reduced section count to the ELF header*/ in ELi_LoadObject()
662 ElfHandle->CurrentEhdr.e_shstrndx = shdr_table[ElfHandle->CurrentEhdr.e_shstrndx]; in ELi_LoadObject()
664 ElfHandle->CurrentEhdr.e_shoff = newelf_shoff; in ELi_LoadObject()
665 …memcpy( (u8*)buf, &(ElfHandle->CurrentEhdr), sizeof( Elf32_Ehdr)); /*Copy ELF header to the stripp… in ELi_LoadObject()
773 CurrentShdrEx = ElfHandle->ShdrEx; in ELi_LoadObject()
783 ElfHandle->ShdrEx = NULL; in ELi_LoadObject()
796 return (ElfHandle->process); in ELi_LoadObject()