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 13 using namespace mcld; 14 15 X86ELFDynamic::X86ELFDynamic(const GNULDBackend& pParent) 16 : ELFDynamic(pParent), m_HasGOTPLT(false) { 17 } 18 19 X86ELFDynamic::~X86ELFDynamic() { 20 } 21 22 void X86ELFDynamic::reserveTargetEntries(const ELFFileFormat& pFormat) { 23 // reservePLTGOT 24 if (m_HasGOTPLT ? pFormat.hasGOTPLT() : pFormat.hasGOT()) 25 reserveOne(llvm::ELF::DT_PLTGOT); 26 } 27 28 void X86ELFDynamic::applyTargetEntries(const ELFFileFormat& pFormat) { 29 // applyPLTGOT 30 if (m_HasGOTPLT) { 31 if (pFormat.hasGOTPLT()) 32 applyOne(llvm::ELF::DT_PLTGOT, pFormat.getGOTPLT().addr()); 33 } 34 else if (pFormat.hasGOT()) 35 applyOne(llvm::ELF::DT_PLTGOT, pFormat.getGOT().addr()); 36 } 37