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

Method MarkSectionUsed

IDEHelper/Backend/BeCOFFObject.cpp:2498–2543  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2496}
2497
2498void BeCOFFObject::MarkSectionUsed(BeCOFFSection& sect, bool getSectSymbol)
2499{
2500 if (sect.mSectionIdx == -1)
2501 {
2502 sect.mSectionIdx = (int)mUsedSections.size();
2503 mUsedSections.push_back(&sect);
2504 }
2505
2506 if (getSectSymbol)
2507 {
2508 //TODO: We previously only did sectionDefs when we needed the SelectionNum value, but
2509 // omitting this causes the MS linker to throw "multiple '<X>' sections found with different
2510 // attributes (0000000000) errors. This change could potentially break LIB creation in the
2511 // linker. Verify it still works.
2512 if (((sect.mCharacteristics & IMAGE_SCN_LNK_COMDAT) != 0) || (true))
2513 {
2514 if (sect.mSymbolIdx == -1)
2515 {
2516 BeMCSymbol* sym;
2517 sym = mSymbols.Alloc();
2518 sym->mSymKind = BeMCSymbolKind_SectionDef;
2519 sym->mName = sect.mSectName;
2520 sym->mIsStatic = false;
2521 sym->mSectionNum = sect.mSectionIdx + 1;
2522 sym->mIdx = (int)mSymbols.size() - 1;
2523 sect.mSymbolIdx = sym->mIdx;
2524 sym = mSymbols.Alloc();
2525 sym->mSymKind = BeMCSymbolKind_AuxPlaceholder;
2526 }
2527 }
2528 else
2529 {
2530 // It's important for the linker's import library output to include
2531 // section refs and not section defs, even when they aren't an external
2532 // reference
2533 BeMCSymbol* sym;
2534 sym = mSymbols.Alloc();
2535 sym->mSymKind = BeMCSymbolKind_SectionRef;
2536 sym->mName = sect.mSectName;
2537 sym->mIsStatic = false;
2538 sym->mSectionNum = sect.mSectionIdx + 1;
2539 sym->mIdx = (int)mSymbols.size() - 1;
2540 sect.mSymbolIdx = sym->mIdx;
2541 }
2542 }
2543}
2544
2545BeMCSymbol* BeCOFFObject::GetCOMDAT(const StringImpl& name, void* data, int size, int align)
2546{

Callers 1

Calls 3

sizeMethod · 0.45
push_backMethod · 0.45
AllocMethod · 0.45

Tested by

no test coverage detected