Please use GitHub pull requests for new patches. Avoid migrating existing patches. Phabricator shutdown timeline
Changeset View
Changeset View
Standalone View
Standalone View
llvm/tools/obj2yaml/coff2yaml.cpp
Show First 20 Lines • Show All 113 Lines • ▼ Show 20 Lines | for (const auto &S : Obj.sections()) { | ||||
} | } | ||||
ArrayRef<uint8_t> sectionData; | ArrayRef<uint8_t> sectionData; | ||||
if ((*SectionNameOrErr) != ".debug$S") | if ((*SectionNameOrErr) != ".debug$S") | ||||
continue; | continue; | ||||
const object::coff_section *COFFSection = Obj.getCOFFSection(S); | const object::coff_section *COFFSection = Obj.getCOFFSection(S); | ||||
cantFail(Obj.getSectionContents(COFFSection, sectionData)); | llvm_cantFail(Obj.getSectionContents(COFFSection, sectionData)); | ||||
BinaryStreamReader Reader(sectionData, support::little); | BinaryStreamReader Reader(sectionData, support::little); | ||||
uint32_t Magic; | uint32_t Magic; | ||||
Err(Reader.readInteger(Magic)); | Err(Reader.readInteger(Magic)); | ||||
assert(Magic == COFF::DEBUG_SECTION_MAGIC && "Invalid .debug$S section!"); | assert(Magic == COFF::DEBUG_SECTION_MAGIC && "Invalid .debug$S section!"); | ||||
codeview::DebugSubsectionArray Subsections; | codeview::DebugSubsectionArray Subsections; | ||||
▲ Show 20 Lines • Show All 43 Lines • ▼ Show 20 Lines | NewYAMLSection.Header.PointerToRelocations = | ||||
COFFSection->PointerToRelocations; | COFFSection->PointerToRelocations; | ||||
NewYAMLSection.Header.SizeOfRawData = COFFSection->SizeOfRawData; | NewYAMLSection.Header.SizeOfRawData = COFFSection->SizeOfRawData; | ||||
uint32_t Shift = (COFFSection->Characteristics >> 20) & 0xF; | uint32_t Shift = (COFFSection->Characteristics >> 20) & 0xF; | ||||
NewYAMLSection.Alignment = (1U << Shift) >> 1; | NewYAMLSection.Alignment = (1U << Shift) >> 1; | ||||
assert(NewYAMLSection.Alignment <= 8192); | assert(NewYAMLSection.Alignment <= 8192); | ||||
ArrayRef<uint8_t> sectionData; | ArrayRef<uint8_t> sectionData; | ||||
if (!ObjSection.isBSS()) | if (!ObjSection.isBSS()) | ||||
cantFail(Obj.getSectionContents(COFFSection, sectionData)); | llvm_cantFail(Obj.getSectionContents(COFFSection, sectionData)); | ||||
NewYAMLSection.SectionData = yaml::BinaryRef(sectionData); | NewYAMLSection.SectionData = yaml::BinaryRef(sectionData); | ||||
if (NewYAMLSection.Name == ".debug$S") | if (NewYAMLSection.Name == ".debug$S") | ||||
NewYAMLSection.DebugS = CodeViewYAML::fromDebugS(sectionData, SC); | NewYAMLSection.DebugS = CodeViewYAML::fromDebugS(sectionData, SC); | ||||
else if (NewYAMLSection.Name == ".debug$T") | else if (NewYAMLSection.Name == ".debug$T") | ||||
NewYAMLSection.DebugT = CodeViewYAML::fromDebugT(sectionData, | NewYAMLSection.DebugT = CodeViewYAML::fromDebugT(sectionData, | ||||
NewYAMLSection.Name); | NewYAMLSection.Name); | ||||
else if (NewYAMLSection.Name == ".debug$P") | else if (NewYAMLSection.Name == ".debug$P") | ||||
▲ Show 20 Lines • Show All 174 Lines • Show Last 20 Lines |