aboutsummaryrefslogtreecommitdiffstats
path: root/include/llvm/Object
diff options
context:
space:
mode:
authorTim Northover <Tim.Northover@arm.com>2013-02-11 11:16:02 +0000
committerTim Northover <Tim.Northover@arm.com>2013-02-11 11:16:02 +0000
commitb05dc5546062f29bf08837db8f680879aa1c14cf (patch)
tree0702819f445b654d2657f5396fc6e48723dc9d31 /include/llvm/Object
parentc37aa995e3e55c1bdb17a73c3160edf0426b1a1a (diff)
downloadexternal_llvm-b05dc5546062f29bf08837db8f680879aa1c14cf.zip
external_llvm-b05dc5546062f29bf08837db8f680879aa1c14cf.tar.gz
external_llvm-b05dc5546062f29bf08837db8f680879aa1c14cf.tar.bz2
AArch64: Add basic relocation processing for llvm-dwarfdump.
This allows llvm-dwarfdump to handle the relocations needed, at least for LLVM-produced code. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@174874 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm/Object')
-rw-r--r--include/llvm/Object/RelocVisitor.h30
1 files changed, 30 insertions, 0 deletions
diff --git a/include/llvm/Object/RelocVisitor.h b/include/llvm/Object/RelocVisitor.h
index edac899..2dcbdf9 100644
--- a/include/llvm/Object/RelocVisitor.h
+++ b/include/llvm/Object/RelocVisitor.h
@@ -92,6 +92,16 @@ public:
HasError = true;
return RelocToApply();
}
+ } else if (FileFormat == "ELF64-aarch64") {
+ switch (RelocType) {
+ case llvm::ELF::R_AARCH64_ABS32:
+ return visitELF_AARCH64_ABS32(R, Value);
+ case llvm::ELF::R_AARCH64_ABS64:
+ return visitELF_AARCH64_ABS64(R, Value);
+ default:
+ HasError = true;
+ return RelocToApply();
+ }
}
HasError = true;
return RelocToApply();
@@ -172,6 +182,26 @@ private:
uint32_t Res = (Value + Addend) & 0xFFFFFFFF;
return RelocToApply(Res, 4);
}
+
+ // AArch64 ELF
+ RelocToApply visitELF_AARCH64_ABS32(RelocationRef R, uint64_t Value) {
+ int64_t Addend;
+ R.getAdditionalInfo(Addend);
+ int64_t Res = Value + Addend;
+
+ // Overflow check allows for both signed and unsigned interpretation.
+ if (Res < INT32_MIN || Res > UINT32_MAX)
+ HasError = true;
+
+ return RelocToApply(static_cast<uint32_t>(Res), 4);
+ }
+
+ RelocToApply visitELF_AARCH64_ABS64(RelocationRef R, uint64_t Value) {
+ int64_t Addend;
+ R.getAdditionalInfo(Addend);
+ return RelocToApply(Value + Addend, 8);
+ }
+
};
}