ELF/AArch64: consolidate getAArch64Page implementation
authorAdhemerval Zanella <adhemerval.zanella@linaro.org>
Mon, 5 Dec 2016 14:14:26 +0000 (14:14 +0000)
committerAdhemerval Zanella <adhemerval.zanella@linaro.org>
Mon, 5 Dec 2016 14:14:26 +0000 (14:14 +0000)
This patch avoid getAArch64Page code duplication by removing the
implementation at InputSection.

llvm-svn: 288668

lld/ELF/InputSection.cpp
lld/ELF/Target.cpp
lld/ELF/Target.h

index 067f629..ae84d7f 100644 (file)
@@ -303,13 +303,6 @@ void InputSection<ELFT>::copyRelocations(uint8_t *Buf, ArrayRef<RelTy> Rels) {
   }
 }
 
-// Page(Expr) is the page address of the expression Expr, defined
-// as (Expr & ~0xFFF). (This applies even if the machine page size
-// supported by the platform has a different value.)
-static uint64_t getAArch64Page(uint64_t Expr) {
-  return Expr & (~static_cast<uint64_t>(0xFFF));
-}
-
 static uint32_t getARMUndefinedRelativeWeakVA(uint32_t Type, uint32_t A,
                                               uint32_t P) {
   switch (Type) {
index 97c2900..c72d46a 100644 (file)
@@ -1274,7 +1274,10 @@ void AArch64TargetInfo::writeGotPlt(uint8_t *Buf, const SymbolBody &) const {
   write64le(Buf, In<ELF64LE>::Plt->getVA());
 }
 
-static uint64_t getAArch64Page(uint64_t Expr) {
+// Page(Expr) is the page address of the expression Expr, defined
+// as (Expr & ~0xFFF). (This applies even if the machine page size
+// supported by the platform has a different value.)
+uint64_t getAArch64Page(uint64_t Expr) {
   return Expr & (~static_cast<uint64_t>(0xFFF));
 }
 
index 9cc3578..9e995ed 100644 (file)
@@ -105,6 +105,7 @@ public:
 
 std::string toString(uint32_t RelType);
 uint64_t getPPC64TocBase();
+uint64_t getAArch64Page(uint64_t Expr);
 
 extern TargetInfo *Target;
 TargetInfo *createTarget();