X86ELFDynamic.cpp revision 5460a1f25d9ddecb5c70667267d66d51af177a99
1//===- X86ELFDynamic.cpp --------------------------------------------------===// 2// 3// The MCLinker Project 4// 5// This file is distributed under the University of Illinois Open Source 6// License. See LICENSE.TXT for details. 7// 8//===----------------------------------------------------------------------===// 9 10#include <mcld/LD/ELFFileFormat.h> 11#include "X86ELFDynamic.h" 12 13using namespace mcld; 14 15X86ELFDynamic::X86ELFDynamic(const GNULDBackend& pParent) 16 : ELFDynamic(pParent), m_HasGOTPLT(false) 17{ 18} 19 20X86ELFDynamic::~X86ELFDynamic() 21{ 22} 23 24void X86ELFDynamic::reserveTargetEntries(const ELFFileFormat& pFormat) 25{ 26 // reservePLTGOT 27 if (m_HasGOTPLT ? pFormat.hasGOTPLT() : pFormat.hasGOT()) 28 reserveOne(llvm::ELF::DT_PLTGOT); 29} 30 31void X86ELFDynamic::applyTargetEntries(const ELFFileFormat& pFormat) 32{ 33 // applyPLTGOT 34 if (m_HasGOTPLT) { 35 if (pFormat.hasGOTPLT()) 36 applyOne(llvm::ELF::DT_PLTGOT, pFormat.getGOTPLT().addr()); 37 } 38 else if (pFormat.hasGOT()) 39 applyOne(llvm::ELF::DT_PLTGOT, pFormat.getGOT().addr()); 40} 41 42