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 
14 namespace mcld {
15 
AArch64ELFDynamic(const GNULDBackend & pParent,const LinkerConfig & pConfig)16 AArch64ELFDynamic::AArch64ELFDynamic(const GNULDBackend& pParent,
17                                      const LinkerConfig& pConfig)
18     : ELFDynamic(pParent, pConfig) {
19 }
20 
~AArch64ELFDynamic()21 AArch64ELFDynamic::~AArch64ELFDynamic() {
22 }
23 
reserveTargetEntries(const ELFFileFormat & pFormat)24 void 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 
applyTargetEntries(const ELFFileFormat & pFormat)35 void 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