Changeset 60137 in vbox for trunk/src/VBox/ValidationKit/bootsectors/bs3kit
- Timestamp:
- Mar 22, 2016 3:31:02 PM (9 years ago)
- Location:
- trunk/src/VBox/ValidationKit/bootsectors/bs3kit
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/ValidationKit/bootsectors/bs3kit/Makefile.kmk
r60119 r60137 38 38 # 64-bit relocation conversion tool (used via the parent Config.kmk). 39 39 BLDPROGS += VBoxBs3ObjConverter 40 VBoxBs3ObjConverter_TEMPLATE = VBox BldProg40 VBoxBs3ObjConverter_TEMPLATE = VBoxAdvBldProg 41 41 VBoxBs3ObjConverter_SOURCES = $(VBOX_PATH_BS3KIT_SRC)/VBoxBs3ObjConverter.cpp 42 42 -
trunk/src/VBox/ValidationKit/bootsectors/bs3kit/VBoxBs3ObjConverter.cpp
r60136 r60137 36 36 #include <iprt/ctype.h> 37 37 #include <iprt/assert.h> 38 #include <iprt/sort.h> 38 39 #include <iprt/x86.h> 39 40 … … 979 980 "%#018" ELF_FMT_X64 " %#018" ELF_FMT_X64 ": unknown fix up %#x (%+" ELF_FMT_D64 ")\n", 980 981 paRelocs[j].r_offset, paRelocs[j].r_info, bType, paRelocs[j].r_addend); 981 if (RT_UNLIKELY( j > 1 982 && paRelocs[j].r_offset <= paRelocs[j - 1].r_offset 983 && paRelocs[j].r_offset + ELF_AMD64_RELOC_SIZE(ELF64_R_TYPE(paRelocs[j].r_info)) 984 < paRelocs[j - 1].r_offset )) 982 if (RT_UNLIKELY( paRelocs[j].r_offset > paShdrs[i - 1].sh_size 983 || paRelocs[j].r_offset + ELF_AMD64_RELOC_SIZE(ELF64_R_TYPE(paRelocs[j].r_info)) 984 > paShdrs[i - 1].sh_size)) 985 985 fRet = error(pszFile, 986 "%#018" ELF_FMT_X64 " %#018" ELF_FMT_X64 ": out of offset order (prev %" ELF_FMT_X64 ")\n", 987 paRelocs[j].r_offset, paRelocs[j].r_info, paRelocs[j - 1].r_offset); 986 "%#018" ELF_FMT_X64 " %#018" ELF_FMT_X64 ": out of bounds (sh_size %" ELF_FMT_X64 ")\n", 987 paRelocs[j].r_offset, paRelocs[j].r_info, paShdrs[i - 1].sh_size); 988 988 989 uint32_t const iSymbol = ELF64_R_SYM(paRelocs[j].r_info); 989 990 if (RT_UNLIKELY(iSymbol >= cSymbols)) … … 992 993 paRelocs[j].r_offset, paRelocs[j].r_info, iSymbol, cSymbols); 993 994 } 994 if (RT_UNLIKELY( cRelocs > 0995 && fRet996 && ( paRelocs[cRelocs - 1].r_offset > paShdrs[i - 1].sh_size997 || paRelocs[cRelocs - 1].r_offset + ELF_AMD64_RELOC_SIZE(ELF64_R_TYPE(paRelocs[cRelocs-1].r_info))998 > paShdrs[i - 1].sh_size )))999 fRet = error(pszFile,1000 "%#018" ELF_FMT_X64 " %#018" ELF_FMT_X64 ": out of bounds (sh_size %" ELF_FMT_X64 ")\n",1001 paRelocs[cRelocs - 1].r_offset, paRelocs[cRelocs - 1].r_info, paShdrs[i - 1].sh_size);1002 1003 995 } 1004 996 else if (paShdrs[i].sh_type == SHT_REL) … … 1136 1128 return false; 1137 1129 1138 fHaveData |= pThis->paSegments[i].iGrp Def== idxGrpData;1130 fHaveData |= pThis->paSegments[i].iGrpNm == idxGrpData; 1139 1131 break; 1140 1132 } … … 1421 1413 } 1422 1414 1415 /** 1416 * @callback_method_impl{FNRTSORTCMP, For Elf64_Rela tables.} 1417 */ 1418 static DECLCALLBACK(int) convertElfCompareRelA(void const *pvElement1, void const *pvElement2, void *pvUser) 1419 { 1420 Elf64_Rela const *pReloc1 = (Elf64_Rela const *)pvElement1; 1421 Elf64_Rela const *pReloc2 = (Elf64_Rela const *)pvElement2; 1422 if (pReloc1->r_offset < pReloc2->r_offset) 1423 return -1; 1424 if (pReloc1->r_offset > pReloc2->r_offset) 1425 return 1; 1426 return 0; 1427 } 1428 1423 1429 static bool convertElfSectionsToLeDataAndFixupps(POMFWRITER pThis, PCELFDETAILS pElfStuff, uint8_t const *pbFile, size_t cbFile) 1424 1430 { … … 1439 1445 uint8_t const *pbData = &pbFile[paShdrs[i].sh_offset]; 1440 1446 uint32_t off = 0; 1447 1448 /* We sort fixups by r_offset in order to more easily split them into chunks. */ 1449 RTSortShell((void *)paRelocs, cRelocs, sizeof(paRelocs[0]), convertElfCompareRelA, NULL); 1441 1450 1442 1451 /* The OMF record size requires us to split larger sections up. To make … … 1932 1941 return false; 1933 1942 1934 fHaveData |= pThis->paSegments[i].iGrp Def== idxGrpData;1943 fHaveData |= pThis->paSegments[i].iGrpNm == idxGrpData; 1935 1944 } 1936 1945 }
Note:
See TracChangeset
for help on using the changeset viewer.