const object::ELFFile<ELFT> &Obj;
- std::error_code dumpSymbol(const Elf_Sym *Sym, bool IsDynamic,
- ELFYAML::Symbol &S);
+ std::error_code dumpSymbol(const Elf_Sym *Sym, ELFYAML::Symbol &S);
std::error_code dumpCommonSection(const Elf_Shdr *Shdr, ELFYAML::Section &S);
std::error_code dumpCommonRelocationSection(const Elf_Shdr *Shdr,
ELFYAML::RelocationSection &S);
ErrorOr<ELFYAML::RelocationSection *> dumpRelaSection(const Elf_Shdr *Shdr);
ErrorOr<ELFYAML::RawContentSection *>
dumpContentSection(const Elf_Shdr *Shdr);
+ ErrorOr<ELFYAML::NoBitsSection *> dumpNoBitsSection(const Elf_Shdr *Shdr);
ErrorOr<ELFYAML::Group *> dumpGroup(const Elf_Shdr *Shdr);
ErrorOr<ELFYAML::MipsABIFlags *> dumpMipsABIFlags(const Elf_Shdr *Shdr);
Y->Sections.push_back(std::unique_ptr<ELFYAML::Section>(G.get()));
break;
}
+ case ELF::SHT_NOBITS: {
+ ErrorOr<ELFYAML::NoBitsSection *> S = dumpNoBitsSection(&Sec);
+ if (std::error_code EC = S.getError())
+ return EC;
+ Y->Sections.push_back(std::unique_ptr<ELFYAML::Section>(S.get()));
+ break;
+ }
default: {
ErrorOr<ELFYAML::RawContentSection *> S = dumpContentSection(&Sec);
if (std::error_code EC = S.getError())
// Dump symbols
bool IsFirstSym = true;
- for (auto SI = Obj.symbol_begin(), SE = Obj.symbol_end(); SI != SE; ++SI) {
+ for (const Elf_Sym &Sym : Obj.symbols()) {
if (IsFirstSym) {
IsFirstSym = false;
continue;
}
ELFYAML::Symbol S;
- if (std::error_code EC = ELFDumper<ELFT>::dumpSymbol(SI, false, S))
+ if (std::error_code EC = ELFDumper<ELFT>::dumpSymbol(&Sym, S))
return EC;
- switch (SI->getBinding())
+ switch (Sym.getBinding())
{
case ELF::STB_LOCAL:
Y->Symbols.Local.push_back(S);
}
template <class ELFT>
-std::error_code ELFDumper<ELFT>::dumpSymbol(const Elf_Sym *Sym, bool IsDynamic,
+std::error_code ELFDumper<ELFT>::dumpSymbol(const Elf_Sym *Sym,
ELFYAML::Symbol &S) {
S.Type = Sym->getType();
S.Value = Sym->st_value;
S.Size = Sym->st_size;
S.Other = Sym->st_other;
- ErrorOr<StringRef> NameOrErr = Obj.getSymbolName(Sym, IsDynamic);
+ ErrorOr<StringRef> NameOrErr = Obj.getStaticSymbolName(Sym);
if (std::error_code EC = NameOrErr.getError())
return EC;
S.Name = NameOrErr.get();
return S.release();
}
+template <class ELFT>
+ErrorOr<ELFYAML::NoBitsSection *>
+ELFDumper<ELFT>::dumpNoBitsSection(const Elf_Shdr *Shdr) {
+ auto S = make_unique<ELFYAML::NoBitsSection>();
+
+ if (std::error_code EC = dumpCommonSection(Shdr, *S))
+ return EC;
+ S->Size = Shdr->sh_size;
+
+ return S.release();
+}
+
template <class ELFT>
ErrorOr<ELFYAML::Group *> ELFDumper<ELFT>::dumpGroup(const Elf_Shdr *Shdr) {
auto S = make_unique<ELFYAML::Group>();