Changeset View
Changeset View
Standalone View
Standalone View
llvm/lib/ObjectYAML/ELFEmitter.cpp
Show First 20 Lines • Show All 267 Lines • ▼ Show 20 Lines | void writeSectionContent(Elf_Shdr &SHeader, | ||||||||
ContiguousBlobAccumulator &CBA); | ContiguousBlobAccumulator &CBA); | ||||||||
void writeSectionContent(Elf_Shdr &SHeader, | void writeSectionContent(Elf_Shdr &SHeader, | ||||||||
const ELFYAML::DynamicSection &Section, | const ELFYAML::DynamicSection &Section, | ||||||||
ContiguousBlobAccumulator &CBA); | ContiguousBlobAccumulator &CBA); | ||||||||
void writeSectionContent(Elf_Shdr &SHeader, | void writeSectionContent(Elf_Shdr &SHeader, | ||||||||
const ELFYAML::StackSizesSection &Section, | const ELFYAML::StackSizesSection &Section, | ||||||||
ContiguousBlobAccumulator &CBA); | ContiguousBlobAccumulator &CBA); | ||||||||
void writeSectionContent(Elf_Shdr &SHeader, | void writeSectionContent(Elf_Shdr &SHeader, | ||||||||
const ELFYAML::BBAddrMapSection &Section, | |||||||||
ContiguousBlobAccumulator &CBA); | |||||||||
void writeSectionContent(Elf_Shdr &SHeader, | |||||||||
const ELFYAML::HashSection &Section, | const ELFYAML::HashSection &Section, | ||||||||
ContiguousBlobAccumulator &CBA); | ContiguousBlobAccumulator &CBA); | ||||||||
void writeSectionContent(Elf_Shdr &SHeader, | void writeSectionContent(Elf_Shdr &SHeader, | ||||||||
const ELFYAML::AddrsigSection &Section, | const ELFYAML::AddrsigSection &Section, | ||||||||
ContiguousBlobAccumulator &CBA); | ContiguousBlobAccumulator &CBA); | ||||||||
void writeSectionContent(Elf_Shdr &SHeader, | void writeSectionContent(Elf_Shdr &SHeader, | ||||||||
const ELFYAML::NoteSection &Section, | const ELFYAML::NoteSection &Section, | ||||||||
ContiguousBlobAccumulator &CBA); | ContiguousBlobAccumulator &CBA); | ||||||||
▲ Show 20 Lines • Show All 466 Lines • ▼ Show 20 Lines | for (const std::unique_ptr<ELFYAML::Chunk> &D : Doc.Chunks) { | ||||||||
} else if (auto S = dyn_cast<ELFYAML::NoteSection>(Sec)) { | } else if (auto S = dyn_cast<ELFYAML::NoteSection>(Sec)) { | ||||||||
writeSectionContent(SHeader, *S, CBA); | writeSectionContent(SHeader, *S, CBA); | ||||||||
} else if (auto S = dyn_cast<ELFYAML::GnuHashSection>(Sec)) { | } else if (auto S = dyn_cast<ELFYAML::GnuHashSection>(Sec)) { | ||||||||
writeSectionContent(SHeader, *S, CBA); | writeSectionContent(SHeader, *S, CBA); | ||||||||
} else if (auto S = dyn_cast<ELFYAML::DependentLibrariesSection>(Sec)) { | } else if (auto S = dyn_cast<ELFYAML::DependentLibrariesSection>(Sec)) { | ||||||||
writeSectionContent(SHeader, *S, CBA); | writeSectionContent(SHeader, *S, CBA); | ||||||||
} else if (auto S = dyn_cast<ELFYAML::CallGraphProfileSection>(Sec)) { | } else if (auto S = dyn_cast<ELFYAML::CallGraphProfileSection>(Sec)) { | ||||||||
writeSectionContent(SHeader, *S, CBA); | writeSectionContent(SHeader, *S, CBA); | ||||||||
} else if (auto S = dyn_cast<ELFYAML::BBAddrMapSection>(Sec)) { | |||||||||
Lint: Pre-merge checks: clang-tidy: warning: 'auto S' can be declared as 'auto *S' [llvm-qualified-auto]
[[https… | |||||||||
writeSectionContent(SHeader, *S, CBA); | |||||||||
} else { | } else { | ||||||||
llvm_unreachable("Unknown section type"); | llvm_unreachable("Unknown section type"); | ||||||||
} | } | ||||||||
LocationCounter += SHeader.sh_size; | LocationCounter += SHeader.sh_size; | ||||||||
// Override section fields if requested. | // Override section fields if requested. | ||||||||
overrideFields<ELFT>(Sec, SHeader); | overrideFields<ELFT>(Sec, SHeader); | ||||||||
▲ Show 20 Lines • Show All 544 Lines • ▼ Show 20 Lines | void ELFState<ELFT>::writeSectionContent( | ||||||||
for (const ELFYAML::StackSizeEntry &E : *Section.Entries) { | for (const ELFYAML::StackSizeEntry &E : *Section.Entries) { | ||||||||
CBA.write<uintX_t>(E.Address, ELFT::TargetEndianness); | CBA.write<uintX_t>(E.Address, ELFT::TargetEndianness); | ||||||||
SHeader.sh_size += sizeof(uintX_t) + CBA.writeULEB128(E.Size); | SHeader.sh_size += sizeof(uintX_t) + CBA.writeULEB128(E.Size); | ||||||||
} | } | ||||||||
} | } | ||||||||
template <class ELFT> | template <class ELFT> | ||||||||
void ELFState<ELFT>::writeSectionContent( | void ELFState<ELFT>::writeSectionContent( | ||||||||
Elf_Shdr &SHeader, const ELFYAML::BBAddrMapSection &Section, | |||||||||
ContiguousBlobAccumulator &CBA) { | |||||||||
if (!Section.Entries) | |||||||||
return; | |||||||||
for (const ELFYAML::BBAddrMapEntry &E : *Section.Entries) { | |||||||||
// Write the address of the function. | |||||||||
CBA.write<uintX_t>(E.Address, ELFT::TargetEndianness); | |||||||||
// Write number of BBEntries (number of basic blocks in the function). | |||||||||
size_t NumBlocks = E.BBEntries ? E.BBEntries->size() : 0; | |||||||||
SHeader.sh_size += sizeof(uintX_t) + CBA.writeULEB128(NumBlocks); | |||||||||
grimar: | |||||||||
Adopted in the line above. rahmanl: Adopted in the line above. | |||||||||
if (!NumBlocks) | |||||||||
continue; | |||||||||
// Write all BBEntries. | |||||||||
for (const ELFYAML::BBAddrMapEntry::BBEntry &BBE : *E.BBEntries) | |||||||||
SHeader.sh_size += CBA.writeULEB128(BBE.AddressOffset) + | |||||||||
CBA.writeULEB128(BBE.Size) + | |||||||||
You don't need to have curly braces here. grimar: You don't need to have curly braces here. | |||||||||
CBA.writeULEB128(BBE.Metadata); | |||||||||
} | |||||||||
} | |||||||||
template <class ELFT> | |||||||||
void ELFState<ELFT>::writeSectionContent( | |||||||||
Elf_Shdr &SHeader, const ELFYAML::LinkerOptionsSection &Section, | Elf_Shdr &SHeader, const ELFYAML::LinkerOptionsSection &Section, | ||||||||
ContiguousBlobAccumulator &CBA) { | ContiguousBlobAccumulator &CBA) { | ||||||||
if (!Section.Options) | if (!Section.Options) | ||||||||
return; | return; | ||||||||
for (const ELFYAML::LinkerOption &LO : *Section.Options) { | for (const ELFYAML::LinkerOption &LO : *Section.Options) { | ||||||||
CBA.write(LO.Key.data(), LO.Key.size()); | CBA.write(LO.Key.data(), LO.Key.size()); | ||||||||
CBA.write('\0'); | CBA.write('\0'); | ||||||||
▲ Show 20 Lines • Show All 603 Lines • Show Last 20 Lines |
clang-tidy: warning: 'auto S' can be declared as 'auto *S' [llvm-qualified-auto]
not useful