Changeset 59955 in vbox
- Timestamp:
- Mar 8, 2016 3:25:33 PM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/ValidationKit/bootsectors/bs3kit/VBoxBs3ObjConverter.cpp
r59954 r59955 802 802 typedef struct ELFDETAILS 803 803 { 804 /** The ELF header. */ 804 805 Elf64_Ehdr const *pEhdr; 806 /** The section header table. */ 805 807 Elf64_Shdr const *paShdrs; 808 /** The string table for the section names. */ 806 809 const char *pchShStrTab; 810 811 /** The symbol table section number. UINT16_MAX if not found. */ 807 812 uint16_t iSymSh; 813 /** The string table section number. UINT16_MAX if not found. */ 808 814 uint16_t iStrSh; 815 816 /** The symbol table. */ 817 Elf64_Sym const *paSymbols; 818 /** The number of symbols in the symbol table. */ 819 uint32_t cSymbols; 820 821 /** Pointer to the (symbol) string table if found. */ 822 const char *pchStrTab; 823 /** The string table size. */ 824 size_t cbStrTab; 825 809 826 } ELFDETAILS; 810 827 typedef ELFDETAILS *PELFDETAILS; … … 920 937 } 921 938 } 939 else if (paShdrs[i].sh_type == SHT_REL) 940 fRet = error(pszFile, "Section #%u '%s': Unexpected SHT_REL section\n", i, pszShNm); 922 941 else if (paShdrs[i].sh_type == SHT_SYMTAB) 923 942 { 943 if (paShdrs[i].sh_entsize != sizeof(Elf64_Sym)) 944 fRet = error(pszFile, "Section #%u '%s': Unsupported symbol table entry size in : #%u (expected #%u)\n", 945 i, pszShNm, paShdrs[i].sh_entsize, sizeof(Elf64_Sym)); 946 uint32_t cSymbols = paShdrs[i].sh_size / paShdrs[i].sh_entsize; 947 if ((Elf64_Xword)cSymbols * paShdrs[i].sh_entsize != paShdrs[i].sh_size) 948 fRet = error(pszFile, "Section #%u '%s': Size not a multiple of entry size: %#" ELF_FMT_X64 " %% %#" ELF_FMT_X64 " = %#" ELF_FMT_X64 "\n", 949 i, pszShNm, paShdrs[i].sh_size, paShdrs[i].sh_entsize, paShdrs[i].sh_size % paShdrs[i].sh_entsize); 924 950 if (pElfStuff->iSymSh == UINT16_MAX) 925 951 { 926 pElfStuff->iSymSh = (uint16_t)i; 927 if (paShdrs[i].sh_entsize == sizeof(Elf64_Sym)) 952 pElfStuff->iSymSh = (uint16_t)i; 953 pElfStuff->paSymbols = (Elf64_Sym const *)&pbFile[paShdrs[i].sh_offset]; 954 pElfStuff->cSymbols = cSymbols; 955 956 if (paShdrs[i].sh_link != 0) 928 957 { 929 958 /* Note! The symbol string table section header may not have been validated yet! */ 959 Elf64_Shdr const *pStrTabShdr = &paShdrs[paShdrs[i].sh_link]; 960 pElfStuff->iStrSh = paShdrs[i].sh_link; 961 pElfStuff->pchStrTab = (const char *)&pbFile[pStrTabShdr->sh_offset]; 962 pElfStuff->cbStrTab = (size_t)pStrTabShdr->sh_size; 930 963 } 931 964 else 932 fRet = error(pszFile, " Unsupported symbol table entry size: #%u (expected #%u)\n",933 i, pszShNm, paShdrs[i].sh_ entsize, sizeof(Elf64_Sym));965 fRet = error(pszFile, "Section #%u '%s': String table link is out of bounds (%#x)\n", 966 i, pszShNm, paShdrs[i].sh_link); 934 967 } 935 968 else 936 fRet = error(pszFile, "2nd symbol table found #%u '%s' (previous #u)\n", i, pszShNm, pElfStuff->iSymSh); 937 } 938 else if (paShdrs[i].sh_type == SHT_REL) 939 fRet = error(pszFile, "Did not expect SHT_REL sections (#%u '%s')\n", i, pszShNm); 969 fRet = error(pszFile, "Section #%u '%s': Found additonal symbol table, previous in #%u\n", 970 i, pszShNm, pElfStuff->iSymSh); 971 } 940 972 } 941 973 return fRet;
Note:
See TracChangeset
for help on using the changeset viewer.