[PATCH] D27306: ELF: consolidate getAArch64Page implementation

Adhemerval Zanella via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Dec 1 10:03:50 PST 2016


zatrazz created this revision.
zatrazz added reviewers: ruiu, rafael, rengolin.
zatrazz added a subscriber: llvm-commits.
zatrazz set the repository for this revision to rL LLVM.
zatrazz added a project: lld.
Herald added a subscriber: aemerson.

This patch avoid getAArch64Page code duplication by removing the
implementation at InputSection.


Repository:
  rL LLVM

https://reviews.llvm.org/D27306

Files:
  ELF/InputSection.cpp
  ELF/Target.cpp
  ELF/Target.h


Index: ELF/Target.h
===================================================================
--- ELF/Target.h
+++ ELF/Target.h
@@ -105,6 +105,7 @@
 
 std::string toString(uint32_t RelType);
 uint64_t getPPC64TocBase();
+uint64_t getAArch64Page(uint64_t Expr);
 
 extern TargetInfo *Target;
 TargetInfo *createTarget();
Index: ELF/Target.cpp
===================================================================
--- ELF/Target.cpp
+++ ELF/Target.cpp
@@ -1262,7 +1262,10 @@
   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: ELF/InputSection.cpp
===================================================================
--- ELF/InputSection.cpp
+++ ELF/InputSection.cpp
@@ -302,13 +302,6 @@
   }
 }
 
-// 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) {


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D27306.79938.patch
Type: text/x-patch
Size: 1475 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20161201/b84b39f4/attachment.bin>


More information about the llvm-commits mailing list