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