Changeset 41510 in vbox for trunk/src/VBox/Runtime/common
- Timestamp:
- May 30, 2012 8:05:54 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Runtime/common/ldr/ldrELFRelocatable.cpp.h
r39083 r41510 141 141 { 142 142 const uint8_t *pu8 = (const uint8_t *)pModElf->pvBits; 143 pModElf->paSyms = (const Elf_Sym *)(pu8 + pModElf->paShdrs[pModElf->iSymSh].sh_offset); 144 pModElf->pStr = (const char *)(pu8 + pModElf->paShdrs[pModElf->iStrSh].sh_offset); 143 if (pModElf->iSymSh != ~0U) 144 pModElf->paSyms = (const Elf_Sym *)(pu8 + pModElf->paShdrs[pModElf->iSymSh].sh_offset); 145 if (pModElf->iStrSh != ~0U) 146 pModElf->pStr = (const char *)(pu8 + pModElf->paShdrs[pModElf->iStrSh].sh_offset); 145 147 } 146 148 return rc; … … 513 515 static DECLCALLBACK(int) RTLDRELF_NAME(GetBits)(PRTLDRMODINTERNAL pMod, void *pvBits, RTUINTPTR BaseAddress, PFNRTLDRIMPORT pfnGetImport, void *pvUser) 514 516 { 515 PRTLDRMODELF pModElf = (PRTLDRMODELF)pMod; 517 PRTLDRMODELF pModElf = (PRTLDRMODELF)pMod; 518 519 /* 520 * This operation is currently only available on relocatable images. 521 */ 522 switch (pModElf->Ehdr.e_type) 523 { 524 case ET_REL: 525 break; 526 case ET_EXEC: 527 Log(("RTLdrELF: %s: Executable images are not supported yet!\n", pModElf->pReader->pfnLogName(pModElf->pReader))); 528 return VERR_LDRELF_EXEC; 529 case ET_DYN: 530 Log(("RTLdrELF: %s: Dynamic images are not supported yet!\n", pModElf->pReader->pfnLogName(pModElf->pReader))); 531 return VERR_LDRELF_DYN; 532 default: AssertFailedReturn(VERR_BAD_EXE_FORMAT); 533 } 516 534 517 535 /* … … 558 576 RTUINTPTR OldBaseAddress, PFNRTLDRIMPORT pfnGetImport, void *pvUser) 559 577 { 560 PRTLDRMODELF pModElf = (PRTLDRMODELF)pMod; 578 PRTLDRMODELF pModElf = (PRTLDRMODELF)pMod; 579 #ifdef LOG_ENABLED 580 const char *pszLogName = pModElf->pReader->pfnLogName(pModElf->pReader); 581 #endif 561 582 NOREF(OldBaseAddress); 583 584 /* 585 * This operation is currently only available on relocatable images. 586 */ 587 switch (pModElf->Ehdr.e_type) 588 { 589 case ET_REL: 590 break; 591 case ET_EXEC: 592 Log(("RTLdrELF: %s: Executable images are not supported yet!\n", pszLogName)); 593 return VERR_LDRELF_EXEC; 594 case ET_DYN: 595 Log(("RTLdrELF: %s: Dynamic images are not supported yet!\n", pszLogName)); 596 return VERR_LDRELF_DYN; 597 default: AssertFailedReturn(VERR_BAD_EXE_FORMAT); 598 } 562 599 563 600 /* … … 580 617 */ 581 618 const Elf_Shdr *paShdrs = pModElf->paShdrs; 582 #ifdef LOG_ENABLED583 const char *pszLogName = pModElf->pReader->pfnLogName(pModElf->pReader);584 619 Log2(("rtLdrElf: %s: Fixing up image\n", pszLogName)); 585 #endif586 620 for (unsigned iShdr = 0; iShdr < pModElf->Ehdr.e_shnum; iShdr++) 587 621 { … … 648 682 */ 649 683 const char *pStr = pModElf->pStr; 650 const Elf_Sym *paSyms = pModElf->paSyms;684 const Elf_Sym *paSyms = pModElf->paSyms; 651 685 unsigned cSyms = pModElf->cSyms; 652 686 for (unsigned iSym = 1; iSym < cSyms; iSym++) … … 859 893 { 860 894 case ET_REL: 895 case ET_EXEC: 896 case ET_DYN: 861 897 break; 862 case ET_EXEC:863 Log(("RTLdrELF: %s: Executable images are not supported yet!\n", pszLogName));864 return VERR_LDRELF_EXEC;865 case ET_DYN:866 Log(("RTLdrELF: %s: Dynamic images are not supported yet!\n", pszLogName));867 return VERR_LDRELF_DYN;868 898 default: 869 899 Log(("RTLdrELF: %s: image type %#x is not supported!\n", pszLogName, pEhdr->e_type)); … … 1161 1191 Log2(("RTLdrElf: iSymSh=%u cSyms=%u iStrSh=%u cbStr=%u rc=%Rrc cbImage=%#zx\n", 1162 1192 pModElf->iSymSh, pModElf->cSyms, pModElf->iStrSh, pModElf->cbStr, rc, pModElf->cbImage)); 1163 1193 #if 0 1164 1194 /* 1165 1195 * Are the section headers fine? … … 1169 1199 || pModElf->iStrSh == ~0U) 1170 1200 rc = VERR_LDRELF_NO_SYMBOL_OR_NO_STRING_TABS; 1201 #endif 1171 1202 if (RT_SUCCESS(rc)) 1172 1203 {
Note:
See TracChangeset
for help on using the changeset viewer.