diff options
author | George Rimar <grimar@accesssoftek.com> | 2019-09-05 08:59:28 +0000 |
---|---|---|
committer | George Rimar <grimar@accesssoftek.com> | 2019-09-05 08:59:28 +0000 |
commit | 33b1a0eb5e73abeb1a6405f8722664ae2e68c02b (patch) | |
tree | ee627768c1696b2315af3eb082a8a34ee597dafe | |
parent | cac96e605787ca67a1c1e7226c8db1d90ea88b6b (diff) | |
download | bcm5719-llvm-33b1a0eb5e73abeb1a6405f8722664ae2e68c02b.tar.gz bcm5719-llvm-33b1a0eb5e73abeb1a6405f8722664ae2e68c02b.zip |
[lib/ObjectYAML] - Cleanup the private interface of ELFState<ELFT>. NFCI.
In D62809 I accidentally added "ELFState<ELFT> &State" as the
first parameter to two methods. There is no reason for having that.
I removed this argument and also moved finalizeStrings declaration to
remove an excessive 'private:' tag.
Differential revision: https://reviews.llvm.org/D67157
llvm-svn: 371033
-rw-r--r-- | llvm/lib/ObjectYAML/ELFEmitter.cpp | 36 |
1 files changed, 13 insertions, 23 deletions
diff --git a/llvm/lib/ObjectYAML/ELFEmitter.cpp b/llvm/lib/ObjectYAML/ELFEmitter.cpp index 9c74d8ba205..cd3a0faa03d 100644 --- a/llvm/lib/ObjectYAML/ELFEmitter.cpp +++ b/llvm/lib/ObjectYAML/ELFEmitter.cpp @@ -118,11 +118,9 @@ template <class ELFT> class ELFState { bool buildSymbolIndexes(); void initELFHeader(Elf_Ehdr &Header); void initProgramHeaders(std::vector<Elf_Phdr> &PHeaders); - bool initImplicitHeader(ELFState<ELFT> &State, ContiguousBlobAccumulator &CBA, - Elf_Shdr &Header, StringRef SecName, - ELFYAML::Section *YAMLSec); - bool initSectionHeaders(ELFState<ELFT> &State, - std::vector<Elf_Shdr> &SHeaders, + bool initImplicitHeader(ContiguousBlobAccumulator &CBA, Elf_Shdr &Header, + StringRef SecName, ELFYAML::Section *YAMLSec); + bool initSectionHeaders(std::vector<Elf_Shdr> &SHeaders, ContiguousBlobAccumulator &CBA); void initSymtabSectionHeader(Elf_Shdr &SHeader, SymtabType STType, ContiguousBlobAccumulator &CBA, @@ -133,6 +131,7 @@ template <class ELFT> class ELFState { ELFYAML::Section *YAMLSec); void setProgramHeaderLayout(std::vector<Elf_Phdr> &PHeaders, std::vector<Elf_Shdr> &SHeaders); + void finalizeStrings(); bool writeSectionContent(Elf_Shdr &SHeader, const ELFYAML::RawContentSection &Section, ContiguousBlobAccumulator &CBA); @@ -163,9 +162,6 @@ template <class ELFT> class ELFState { public: static int writeELF(raw_ostream &OS, ELFYAML::Object &Doc); - -private: - void finalizeStrings(); }; } // end anonymous namespace @@ -267,8 +263,7 @@ static bool convertSectionIndex(NameToIdxMap &SN2I, StringRef SecName, } template <class ELFT> -bool ELFState<ELFT>::initImplicitHeader(ELFState<ELFT> &State, - ContiguousBlobAccumulator &CBA, +bool ELFState<ELFT>::initImplicitHeader(ContiguousBlobAccumulator &CBA, Elf_Shdr &Header, StringRef SecName, ELFYAML::Section *YAMLSec) { // Check if the header was already initialized. @@ -276,19 +271,15 @@ bool ELFState<ELFT>::initImplicitHeader(ELFState<ELFT> &State, return false; if (SecName == ".symtab") - State.initSymtabSectionHeader(Header, SymtabType::Static, CBA, YAMLSec); + initSymtabSectionHeader(Header, SymtabType::Static, CBA, YAMLSec); else if (SecName == ".strtab") - State.initStrtabSectionHeader(Header, SecName, State.DotStrtab, CBA, - YAMLSec); + initStrtabSectionHeader(Header, SecName, DotStrtab, CBA, YAMLSec); else if (SecName == ".shstrtab") - State.initStrtabSectionHeader(Header, SecName, State.DotShStrtab, CBA, - YAMLSec); - + initStrtabSectionHeader(Header, SecName, DotShStrtab, CBA, YAMLSec); else if (SecName == ".dynsym") - State.initSymtabSectionHeader(Header, SymtabType::Dynamic, CBA, YAMLSec); + initSymtabSectionHeader(Header, SymtabType::Dynamic, CBA, YAMLSec); else if (SecName == ".dynstr") - State.initStrtabSectionHeader(Header, SecName, State.DotDynstr, CBA, - YAMLSec); + initStrtabSectionHeader(Header, SecName, DotDynstr, CBA, YAMLSec); else return false; @@ -313,8 +304,7 @@ static StringRef dropUniqueSuffix(StringRef S) { } template <class ELFT> -bool ELFState<ELFT>::initSectionHeaders(ELFState<ELFT> &State, - std::vector<Elf_Shdr> &SHeaders, +bool ELFState<ELFT>::initSectionHeaders(std::vector<Elf_Shdr> &SHeaders, ContiguousBlobAccumulator &CBA) { // Ensure SHN_UNDEF entry is present. An all-zero section header is a // valid SHN_UNDEF entry since SHT_NULL == 0. @@ -330,7 +320,7 @@ bool ELFState<ELFT>::initSectionHeaders(ELFState<ELFT> &State, // in the YAML, we need to write them here. This ensures the file offset // remains correct. Elf_Shdr &SHeader = SHeaders[I]; - if (initImplicitHeader(State, CBA, SHeader, Sec->Name, + if (initImplicitHeader(CBA, SHeader, Sec->Name, Sec->IsImplicit ? nullptr : Sec)) continue; @@ -1066,7 +1056,7 @@ int ELFState<ELFT>::writeELF(raw_ostream &OS, ELFYAML::Object &Doc) { ContiguousBlobAccumulator CBA(SectionContentBeginOffset); std::vector<Elf_Shdr> SHeaders; - if (!State.initSectionHeaders(State, SHeaders, CBA)) + if (!State.initSectionHeaders(SHeaders, CBA)) return 1; // Now we can decide segment offsets |