| 312 | } |
| 313 | |
| 314 | void BlContext::LoadFiles() |
| 315 | { |
| 316 | BL_AUTOPERF("BlContext::LoadFiles"); |
| 317 | |
| 318 | BfSizedVector<BlObjectDataSectInfo, 16> sectInfos; |
| 319 | BfSizedVector<BlObjectDataSymInfo, 256> symInfos; |
| 320 | |
| 321 | String tempStr; |
| 322 | |
| 323 | BfSizedVector<int, 16> orderedRelocSects; |
| 324 | |
| 325 | while (true) |
| 326 | { |
| 327 | orderedRelocSects.clear(); |
| 328 | |
| 329 | if (mObjectDataWorkQueue.empty()) |
| 330 | break; |
| 331 | auto objectData = mObjectDataWorkQueue.back(); |
| 332 | mObjectDataWorkQueue.pop_back(); |
| 333 | |
| 334 | uint8* data = (uint8*)objectData->mData; |
| 335 | PEFileHeader* fileHeader = (PEFileHeader*)data; |
| 336 | |
| 337 | int nameLen = (int)strlen(objectData->mName); |
| 338 | if (nameLen > 4) |
| 339 | { |
| 340 | const char* ext = objectData->mName + nameLen - 4; |
| 341 | if (stricmp(ext, ".res") == 0) |
| 342 | { |
| 343 | LoadResourceData(objectData); |
| 344 | continue; |
| 345 | } |
| 346 | else if (stricmp(ext, ".def") == 0) |
| 347 | { |
| 348 | LoadDefData(objectData); |
| 349 | continue; |
| 350 | } |
| 351 | } |
| 352 | |
| 353 | bool dbgTestFile = false;//strcmp(objectData->mName, "Internal.obj") == 0; |
| 354 | |
| 355 | if (fileHeader->mMachine != PE_MACHINE_X64) |
| 356 | { |
| 357 | if ((fileHeader->mMachine == 0) && (fileHeader->mNumberOfSections <= 1)) |
| 358 | { |
| 359 | // This is an object that contains no code - probably just weak externals |
| 360 | } |
| 361 | else |
| 362 | { |
| 363 | Fail(objectData, "Invalid object file format"); |
| 364 | continue; |
| 365 | } |
| 366 | } |
| 367 | |
| 368 | data += sizeof(PEFileHeader); |
| 369 | PESectionHeader* sectionHeaderArr = (PESectionHeader*)data; |
| 370 | data += fileHeader->mNumberOfSections * sizeof(PESectionHeader); |
| 371 |
nothing calls this directly
no test coverage detected