MCPcopy Create free account
hub / github.com/beefytech/Beef / LoadFiles

Method LoadFiles

IDEHelper/Linker/BlContext.cpp:314–1110  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

312}
313
314void 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

Callers

nothing calls this directly

Calls 15

FailFunction · 0.85
FixLibNameFunction · 0.85
BlExportClass · 0.85
AddTypeDataMethod · 0.80
AddSymbolDataMethod · 0.80
AddChunkMethod · 0.80
AddContributionMethod · 0.80
AddModuleMethod · 0.80
findMethod · 0.80
SubstringMethod · 0.80
IsUsedMethod · 0.80
FinishModuleMethod · 0.80

Tested by

no test coverage detected