Lines Matching defs:mEhdr

89 STATIC Elf_Ehdr *mEhdr;
129 mEhdr = (Elf_Ehdr*) FileBuffer;
134 if (mEhdr->e_ident[EI_CLASS] != ELFCLASS32) {
138 if (mEhdr->e_ident[EI_DATA] != ELFDATA2LSB) {
142 if ((mEhdr->e_type != ET_EXEC) && (mEhdr->e_type != ET_DYN)) {
146 if (!((mEhdr->e_machine == EM_386) || (mEhdr->e_machine == EM_ARM))) {
150 if (mEhdr->e_version != EV_CURRENT) {
151 Error (NULL, 0, 3000, "Unsupported", "ELF e_version (%u) not EV_CURRENT (%d)", (unsigned) mEhdr->e_version, EV_CURRENT);
158 mShdrBase = (Elf_Shdr *)((UINT8 *)mEhdr + mEhdr->e_shoff);
159 mPhdrBase = (Elf_Phdr *)((UINT8 *)mEhdr + mEhdr->e_phoff);
164 mCoffSectionsOffset = (UINT32 *)malloc(mEhdr->e_shnum * sizeof (UINT32));
165 memset(mCoffSectionsOffset, 0, mEhdr->e_shnum * sizeof(UINT32));
190 if (Num >= mEhdr->e_shnum)
192 return (Elf_Shdr*)((UINT8*)mShdrBase + Num * mEhdr->e_shentsize);
201 if (num >= mEhdr->e_phnum) {
205 return (Elf_Phdr *)((UINT8*)mPhdrBase + num * mEhdr->e_phentsize);
235 Elf_Shdr *Namedr = GetShdrByIndex(mEhdr->e_shstrndx);
237 return (BOOLEAN) (strcmp((CHAR8*)mEhdr + Namedr->sh_offset + Shdr->sh_name, ELF_HII_SECTION_NAME) == 0);
276 switch (mEhdr->e_machine) {
282 VerboseMsg ("%s unknown e_machine type. Assume IA-32", (UINTN)mEhdr->e_machine);
296 for (i = 0; i < mEhdr->e_shnum; i++) {
314 if ((mEhdr->e_entry >= shdr->sh_addr) &&
315 (mEhdr->e_entry < shdr->sh_addr + shdr->sh_size)) {
316 CoffEntry = mCoffOffset + mEhdr->e_entry - shdr->sh_addr;
324 if (mEhdr->e_machine != EM_ARM) {
337 for (i = 0; i < mEhdr->e_shnum; i++) {
368 for (i = 0; i < mEhdr->e_shnum; i++) {
388 SetHiiResourceHeader ((UINT8*) mEhdr + shdr->sh_offset, mHiiRsrcOffset);
413 switch (mEhdr->e_machine) {
423 VerboseMsg ("%s unknown e_machine type. Assume IA-32", (UINTN)mEhdr->e_machine);
523 for (Idx = 0; Idx < mEhdr->e_shnum; Idx++) {
530 (UINT8*)mEhdr + Shdr->sh_offset,
551 for (Idx = 0; Idx < mEhdr->e_shnum; Idx++) {
577 UINT8 *Symtab = (UINT8*)mEhdr + SymtabShdr->sh_offset;
586 Elf_Rel *Rel = (Elf_Rel *)((UINT8*)mEhdr + RelShdr->sh_offset + RelOffset);
603 || Sym->st_shndx > mEhdr->e_shnum) {
620 if (mEhdr->e_machine == EM_386) {
644 } else if (mEhdr->e_machine == EM_ARM) {
742 for (Index = 0, FoundRelocations = FALSE; Index < mEhdr->e_shnum; Index++) {
751 Elf_Rel *Rel = (Elf_Rel *)((UINT8*)mEhdr + RelShdr->sh_offset + RelIdx);
753 if (mEhdr->e_machine == EM_386) {
772 } else if (mEhdr->e_machine == EM_ARM) {
847 Error (NULL, 0, 3000, "Not Supported", "This tool does not support relocations for ELF with e_machine %u (processor type).", (unsigned) mEhdr->e_machine);
854 if (!FoundRelocations && (mEhdr->e_machine == EM_ARM)) {
857 for (Index = 0; Index < mEhdr->e_phnum; Index++) {
865 Dyn = (Elf32_Dyn *) ((UINT8 *)mEhdr + DynamicSegment->p_offset);
895 Rel = (Elf32_Rel *) ((UINT8 *) mEhdr + DynamicSegment->p_offset + RelOffset + K);
898 Rel = (Elf32_Rel *) ((UINT8 *) mEhdr + RelOffset + K);