ELF2: Remove setNameOffset and combine that with writeHeader. NFC.

llvm-svn: 251193
This commit is contained in:
Rui Ueyama 2015-10-24 17:57:39 +00:00
parent 9fbb3d8850
commit 157c433a83
3 changed files with 2 additions and 4 deletions

View File

@ -224,6 +224,7 @@ InterpSection<ELFT>::InterpSection()
template <class ELFT>
void OutputSectionBase<ELFT>::writeHeaderTo(Elf_Shdr *SHdr) {
Header.sh_name = Out<ELFT>::ShStrTab->getOffset(Name);
*SHdr = Header;
}

View File

@ -80,7 +80,6 @@ public:
void setFileOffset(uintX_t Off) { Header.sh_offset = Off; }
void writeHeaderTo(Elf_Shdr *SHdr);
StringRef getName() { return Name; }
void setNameOffset(uintX_t Offset) { Header.sh_name = Offset; }
unsigned SectionIndex;

View File

@ -740,10 +740,8 @@ template <class ELFT> void Writer<ELFT>::writeHeader() {
auto SHdrs = reinterpret_cast<Elf_Shdr *>(Buf + EHdr->e_shoff);
// First entry is null.
++SHdrs;
for (OutputSectionBase<ELFT> *Sec : OutputSections) {
Sec->setNameOffset(Out<ELFT>::ShStrTab->getOffset(Sec->getName()));
for (OutputSectionBase<ELFT> *Sec : OutputSections)
Sec->writeHeaderTo(SHdrs++);
}
}
template <class ELFT> void Writer<ELFT>::openFile(StringRef Path) {