From 6afe128ae59a85b4809245f42764767cada89537 Mon Sep 17 00:00:00 2001 From: Adhemerval Zanella Date: Mon, 5 Dec 2016 14:14:26 +0000 Subject: [PATCH] ELF/AArch64: consolidate getAArch64Page implementation This patch avoid getAArch64Page code duplication by removing the implementation at InputSection. llvm-svn: 288668 --- lld/ELF/InputSection.cpp | 7 ------- lld/ELF/Target.cpp | 5 ++++- lld/ELF/Target.h | 1 + 3 files changed, 5 insertions(+), 8 deletions(-) diff --git a/lld/ELF/InputSection.cpp b/lld/ELF/InputSection.cpp index 067f629..ae84d7f 100644 --- a/lld/ELF/InputSection.cpp +++ b/lld/ELF/InputSection.cpp @@ -303,13 +303,6 @@ void InputSection::copyRelocations(uint8_t *Buf, ArrayRef 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(0xFFF)); -} - static uint32_t getARMUndefinedRelativeWeakVA(uint32_t Type, uint32_t A, uint32_t P) { switch (Type) { diff --git a/lld/ELF/Target.cpp b/lld/ELF/Target.cpp index 97c2900..c72d46a 100644 --- a/lld/ELF/Target.cpp +++ b/lld/ELF/Target.cpp @@ -1274,7 +1274,10 @@ void AArch64TargetInfo::writeGotPlt(uint8_t *Buf, const SymbolBody &) const { write64le(Buf, In::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(0xFFF)); } diff --git a/lld/ELF/Target.h b/lld/ELF/Target.h index 9cc3578..9e995ed 100644 --- a/lld/ELF/Target.h +++ b/lld/ELF/Target.h @@ -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(); -- 2.7.4