[lld] r244918 - Pass the type and flags to the OutputSection constructor. NFC.
Rafael Espindola via llvm-commits
llvm-commits at lists.llvm.org
Thu Aug 13 10:32:30 PDT 2015
Author: rafael
Date: Thu Aug 13 12:32:30 2015
New Revision: 244918
URL: http://llvm.org/viewvc/llvm-project?rev=244918&view=rev
Log:
Pass the type and flags to the OutputSection constructor. NFC.
This will allow further cleanups.
Modified:
lld/trunk/ELF/Writer.cpp
Modified: lld/trunk/ELF/Writer.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Writer.cpp?rev=244918&r1=244917&r2=244918&view=diff
==============================================================================
--- lld/trunk/ELF/Writer.cpp (original)
+++ lld/trunk/ELF/Writer.cpp Thu Aug 13 12:32:30 2015
@@ -37,8 +37,11 @@ public:
typedef typename llvm::object::ELFFile<ELFT>::uintX_t uintX_t;
typedef typename llvm::object::ELFFile<ELFT>::Elf_Shdr Elf_Shdr;
- OutputSection(StringRef Name) : Name(Name) {
+ OutputSection(StringRef Name, uint32_t sh_type, uintX_t sh_flags)
+ : Name(Name) {
memset(&Header, 0, sizeof(Elf_Shdr));
+ Header.sh_type = sh_type;
+ Header.sh_flags = sh_flags;
}
void setVA(uintX_t);
void setFileOffset(uintX_t);
@@ -133,8 +136,6 @@ void OutputSection<ELFT>::addSectionChun
C->setOutputSectionOff(Off);
Off += C->getSize();
Header.sh_size = Off;
- Header.sh_type = C->getSectionHdr()->sh_type;
- Header.sh_flags |= C->getSectionHdr()->sh_flags;
}
template <class ELFT> void OutputSection<ELFT>::writeHeaderTo(Elf_Shdr *SHdr) {
@@ -180,7 +181,8 @@ template <class ELFT> void Writer<ELFT>:
H->sh_flags};
OutputSection<ELFT> *&Sec = Map[Key];
if (!Sec) {
- Sec = new (CAlloc.Allocate()) OutputSection<ELFT>(C->getSectionName());
+ Sec = new (CAlloc.Allocate())
+ OutputSection<ELFT>(Key.Name, Key.sh_type, Key.sh_flags);
OutputSections.push_back(Sec);
}
Sec->addSectionChunk(C);
More information about the llvm-commits
mailing list