summaryrefslogtreecommitdiffstats
path: root/llvm/lib/ExecutionEngine/RuntimeDyld/Targets/RuntimeDyldCOFFI386.h
diff options
context:
space:
mode:
authorSanjoy Das <sanjoy@playingwithpointers.com>2015-11-23 21:47:41 +0000
committerSanjoy Das <sanjoy@playingwithpointers.com>2015-11-23 21:47:41 +0000
commit277776a52094678997e7652905f434dc336d6221 (patch)
tree7cca1805afe32417da8177fc9bc1c989008d1cca /llvm/lib/ExecutionEngine/RuntimeDyld/Targets/RuntimeDyldCOFFI386.h
parent7c905063c576f5e12ce02f47c5d43da753931582 (diff)
downloadbcm5719-llvm-277776a52094678997e7652905f434dc336d6221.tar.gz
bcm5719-llvm-277776a52094678997e7652905f434dc336d6221.zip
[RuntimeDyld] Add accessors to `SectionEntry`; NFC
Summary: Remove naked access to the data members in `SectionEntry` and route accesses through accessor functions. This makes it obvious how the instances of the class are used, and will also facilitate adding bounds checking to `advanceStubOffset` in a later change. Reviewers: lhames, loladiro, andrew.w.kaylor Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D14674 llvm-svn: 253918
Diffstat (limited to 'llvm/lib/ExecutionEngine/RuntimeDyld/Targets/RuntimeDyldCOFFI386.h')
-rw-r--r--llvm/lib/ExecutionEngine/RuntimeDyld/Targets/RuntimeDyldCOFFI386.h16
1 files changed, 9 insertions, 7 deletions
diff --git a/llvm/lib/ExecutionEngine/RuntimeDyld/Targets/RuntimeDyldCOFFI386.h b/llvm/lib/ExecutionEngine/RuntimeDyld/Targets/RuntimeDyldCOFFI386.h
index f593c9ab15d..fbfbb328523 100644
--- a/llvm/lib/ExecutionEngine/RuntimeDyld/Targets/RuntimeDyldCOFFI386.h
+++ b/llvm/lib/ExecutionEngine/RuntimeDyld/Targets/RuntimeDyldCOFFI386.h
@@ -105,7 +105,7 @@ public:
void resolveRelocation(const RelocationEntry &RE, uint64_t Value) override {
const auto Section = Sections[RE.SectionID];
- uint8_t *Target = Section.Address + RE.Offset;
+ uint8_t *Target = Section.getAddressWithOffset(RE.Offset);
switch (RE.RelType) {
case COFF::IMAGE_REL_I386_ABSOLUTE:
@@ -116,7 +116,8 @@ public:
uint64_t Result =
RE.Sections.SectionA == static_cast<uint32_t>(-1)
? Value
- : Sections[RE.Sections.SectionA].LoadAddress + RE.Addend;
+ : Sections[RE.Sections.SectionA].getLoadAddressWithOffset(
+ RE.Addend);
assert(static_cast<int32_t>(Result) <= INT32_MAX &&
"relocation overflow");
assert(static_cast<int32_t>(Result) >= INT32_MIN &&
@@ -130,9 +131,10 @@ public:
}
case COFF::IMAGE_REL_I386_DIR32NB: {
// The target's 32-bit RVA.
- // NOTE: use Section[0].LoadAddress as an approximation of ImageBase
- uint64_t Result = Sections[RE.Sections.SectionA].LoadAddress + RE.Addend -
- Sections[0].LoadAddress;
+ // NOTE: use Section[0].getLoadAddress() as an approximation of ImageBase
+ uint64_t Result =
+ Sections[RE.Sections.SectionA].getLoadAddressWithOffset(RE.Addend) -
+ Sections[0].getLoadAddress();
assert(static_cast<int32_t>(Result) <= INT32_MAX &&
"relocation overflow");
assert(static_cast<int32_t>(Result) >= INT32_MIN &&
@@ -146,8 +148,8 @@ public:
}
case COFF::IMAGE_REL_I386_REL32: {
// 32-bit relative displacement to the target.
- uint64_t Result = Sections[RE.Sections.SectionA].LoadAddress -
- Section.LoadAddress + RE.Addend - 4 - RE.Offset;
+ uint64_t Result = Sections[RE.Sections.SectionA].getLoadAddress() -
+ Section.getLoadAddress() + RE.Addend - 4 - RE.Offset;
assert(static_cast<int32_t>(Result) <= INT32_MAX &&
"relocation overflow");
assert(static_cast<int32_t>(Result) >= INT32_MIN &&
OpenPOWER on IntegriCloud