blob: a441775a7673558622d27fd31559a0b6dd098567 [file] [log] [blame]
//===- GOT.cpp ------------------------------------------------------------===//
//
// The MCLinker Project
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
#include <llvm/Support/Casting.h>
#include <mcld/LD/LDSection.h>
#include <mcld/Target/GOT.h>
#include <mcld/Support/MsgHandling.h>
#include <mcld/IRBuilder.h>
#include <cstring>
#include <cstdlib>
using namespace mcld;
//===----------------------------------------------------------------------===//
// GOT
//===----------------------------------------------------------------------===//
GOT::GOT(LDSection& pSection)
: m_Section(pSection) {
m_SectionData = IRBuilder::CreateSectionData(pSection);
}
GOT::~GOT()
{
}
void GOT::finalizeSectionSize()
{
uint32_t offset = 0;
SectionData::iterator frag, fragEnd = m_SectionData->end();
for (frag = m_SectionData->begin(); frag != fragEnd; ++frag) {
frag->setOffset(offset);
offset += frag->size();
}
m_Section.setSize(offset);
}