AArch64ELFDynamic.cpp revision 551ae4ebd3e9d137ea668fb83ae4a55b8cfba451
1//===- AArch64ELFDynamic.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#include "AArch64ELFDynamic.h"
10
11#include <mcld/LD/ELFFileFormat.h>
12#include <mcld/LinkerConfig.h>
13
14using namespace mcld;
15
16AArch64ELFDynamic::AArch64ELFDynamic(const GNULDBackend& pParent,
17                                     const LinkerConfig& pConfig)
18  : ELFDynamic(pParent, pConfig)
19{
20}
21
22AArch64ELFDynamic::~AArch64ELFDynamic()
23{
24}
25
26void AArch64ELFDynamic::reserveTargetEntries(const ELFFileFormat& pFormat)
27{
28  // reservePLTGOT
29  if (config().options().hasNow()) {
30    if (pFormat.hasGOT())
31      reserveOne(llvm::ELF::DT_PLTGOT);
32  }
33  else {
34    if (pFormat.hasGOTPLT())
35      reserveOne(llvm::ELF::DT_PLTGOT);
36  }
37}
38
39void AArch64ELFDynamic::applyTargetEntries(const ELFFileFormat& pFormat)
40{
41  // applyPLTGOT
42  if (config().options().hasNow()) {
43    if (pFormat.hasGOT())
44      applyOne(llvm::ELF::DT_PLTGOT, pFormat.getGOT().addr());
45  }
46  else {
47    if (pFormat.hasGOTPLT())
48      applyOne(llvm::ELF::DT_PLTGOT, pFormat.getGOTPLT().addr());
49  }
50}
51
52