summaryrefslogtreecommitdiff
path: root/ELF/Arch/PPC64.cpp
diff options
context:
space:
mode:
authorDimitry Andric <dim@FreeBSD.org>2019-06-11 18:17:23 +0000
committerDimitry Andric <dim@FreeBSD.org>2019-06-11 18:17:23 +0000
commit444e4712399dfed9a74a0a1bd4880ea138a86616 (patch)
tree2ad18ed0a15e9e8be17fbfe03f5221304008ee59 /ELF/Arch/PPC64.cpp
parent515d6c5d32e49955108e6171dfff4d49d9c5cbfb (diff)
Notes
Diffstat (limited to 'ELF/Arch/PPC64.cpp')
-rw-r--r--ELF/Arch/PPC64.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/ELF/Arch/PPC64.cpp b/ELF/Arch/PPC64.cpp
index 8a320c9a4e9e..cbfa8073d33f 100644
--- a/ELF/Arch/PPC64.cpp
+++ b/ELF/Arch/PPC64.cpp
@@ -113,6 +113,7 @@ public:
void writeGotHeader(uint8_t *Buf) const override;
bool needsThunk(RelExpr Expr, RelType Type, const InputFile *File,
uint64_t BranchAddr, const Symbol &S) const override;
+ uint32_t getThunkSectionSpacing() const override;
bool inBranchRange(RelType Type, uint64_t Src, uint64_t Dst) const override;
RelExpr adjustRelaxExpr(RelType Type, const uint8_t *Data,
RelExpr Expr) const override;
@@ -759,6 +760,14 @@ bool PPC64::needsThunk(RelExpr Expr, RelType Type, const InputFile *File,
return !inBranchRange(Type, BranchAddr, S.getVA());
}
+uint32_t PPC64::getThunkSectionSpacing() const {
+ // See comment in Arch/ARM.cpp for a more detailed explanation of
+ // getThunkSectionSpacing(). For PPC64 we pick the constant here based on
+ // R_PPC64_REL24, which is used by unconditional branch instructions.
+ // 0x2000000 = (1 << 24-1) * 4
+ return 0x2000000;
+}
+
bool PPC64::inBranchRange(RelType Type, uint64_t Src, uint64_t Dst) const {
int64_t Offset = Dst - Src;
if (Type == R_PPC64_REL14)