COFF: Set Chunk to OutputSection backreference in addChunk().

When we add a chunk to an OutputSection, we always want to create
a backreference from an OutputSection to a Chunk. To make sure
we always do, do that in addChunk(). NFC.

llvm-svn: 239706
This commit is contained in:
Rui Ueyama 2015-06-14 22:16:47 +00:00
parent 4108f3f393
commit 669236fef3
1 changed files with 1 additions and 1 deletions

View File

@ -70,6 +70,7 @@ void OutputSection::setFileOffset(uint64_t Off) {
void OutputSection::addChunk(Chunk *C) {
Chunks.push_back(C);
C->setOutputSection(this);
uint64_t Off = Header.VirtualSize;
Off = RoundUpToAlignment(Off, C->getAlign());
C->setRVA(Off);
@ -140,7 +141,6 @@ void Writer::createSections() {
}
std::vector<Chunk *> &Chunks = P.second;
for (Chunk *C : Chunks) {
C->setOutputSection(Sec);
Sec->addChunk(C);
Sec->addPermissions(C->getPermissions());
}