summaryrefslogtreecommitdiff
path: root/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldMachO.cpp
diff options
context:
space:
mode:
authorEli Bendersky <eli.bendersky@intel.com>2012-04-30 10:06:27 +0000
committerEli Bendersky <eli.bendersky@intel.com>2012-04-30 10:06:27 +0000
commit6d15e8717767af9a6a20c6ea456119c15c77dd00 (patch)
treebbeb379ab6d8efb43848cf51479cb1223396fd5c /lib/ExecutionEngine/RuntimeDyld/RuntimeDyldMachO.cpp
parent6aa33274ed9e428292989c099957aa096bc80014 (diff)
downloadllvm-6d15e8717767af9a6a20c6ea456119c15c77dd00.tar.gz
llvm-6d15e8717767af9a6a20c6ea456119c15c77dd00.tar.bz2
llvm-6d15e8717767af9a6a20c6ea456119c15c77dd00.tar.xz
Code cleanup in RuntimeDyld:
- Add comments - Change field names to be more reasonable - Fix indentation and naming to conform to coding conventions - Remove unnecessary includes / replace them by forward declatations git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@155815 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/ExecutionEngine/RuntimeDyld/RuntimeDyldMachO.cpp')
-rw-r--r--lib/ExecutionEngine/RuntimeDyld/RuntimeDyldMachO.cpp67
1 files changed, 33 insertions, 34 deletions
diff --git a/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldMachO.cpp b/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldMachO.cpp
index b7f515d6ce..a9574eb0ba 100644
--- a/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldMachO.cpp
+++ b/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldMachO.cpp
@@ -30,7 +30,8 @@ void RuntimeDyldMachO::resolveRelocation(uint8_t *LocalAddress,
unsigned MachoType = (Type >> 28) & 0xf;
unsigned Size = 1 << ((Type >> 25) & 3);
- DEBUG(dbgs() << "resolveRelocation LocalAddress: " << format("%p", LocalAddress)
+ DEBUG(dbgs() << "resolveRelocation LocalAddress: "
+ << format("%p", LocalAddress)
<< " FinalAddress: " << format("%p", FinalAddress)
<< " Value: " << format("%p", Value)
<< " Addend: " << Addend
@@ -53,12 +54,12 @@ void RuntimeDyldMachO::resolveRelocation(uint8_t *LocalAddress,
break;
case Triple::x86:
resolveI386Relocation(LocalAddress,
- FinalAddress,
- (uintptr_t)Value,
- isPCRel,
- Type,
- Size,
- Addend);
+ FinalAddress,
+ (uintptr_t)Value,
+ isPCRel,
+ Type,
+ Size,
+ Addend);
break;
case Triple::arm: // Fall through.
case Triple::thumb:
@@ -73,14 +74,13 @@ void RuntimeDyldMachO::resolveRelocation(uint8_t *LocalAddress,
}
}
-bool RuntimeDyldMachO::
-resolveI386Relocation(uint8_t *LocalAddress,
- uint64_t FinalAddress,
- uint64_t Value,
- bool isPCRel,
- unsigned Type,
- unsigned Size,
- int64_t Addend) {
+bool RuntimeDyldMachO::resolveI386Relocation(uint8_t *LocalAddress,
+ uint64_t FinalAddress,
+ uint64_t Value,
+ bool isPCRel,
+ unsigned Type,
+ unsigned Size,
+ int64_t Addend) {
if (isPCRel)
Value -= FinalAddress + 4; // see resolveX86_64Relocation
@@ -102,14 +102,13 @@ resolveI386Relocation(uint8_t *LocalAddress,
}
}
-bool RuntimeDyldMachO::
-resolveX86_64Relocation(uint8_t *LocalAddress,
- uint64_t FinalAddress,
- uint64_t Value,
- bool isPCRel,
- unsigned Type,
- unsigned Size,
- int64_t Addend) {
+bool RuntimeDyldMachO::resolveX86_64Relocation(uint8_t *LocalAddress,
+ uint64_t FinalAddress,
+ uint64_t Value,
+ bool isPCRel,
+ unsigned Type,
+ unsigned Size,
+ int64_t Addend) {
// If the relocation is PC-relative, the value to be encoded is the
// pointer difference.
if (isPCRel)
@@ -144,14 +143,13 @@ resolveX86_64Relocation(uint8_t *LocalAddress,
}
}
-bool RuntimeDyldMachO::
-resolveARMRelocation(uint8_t *LocalAddress,
- uint64_t FinalAddress,
- uint64_t Value,
- bool isPCRel,
- unsigned Type,
- unsigned Size,
- int64_t Addend) {
+bool RuntimeDyldMachO::resolveARMRelocation(uint8_t *LocalAddress,
+ uint64_t FinalAddress,
+ uint64_t Value,
+ bool isPCRel,
+ unsigned Type,
+ unsigned Size,
+ int64_t Addend) {
// If the relocation is PC-relative, the value to be encoded is the
// pointer difference.
if (isPCRel) {
@@ -269,7 +267,7 @@ void RuntimeDyldMachO::processRelocationRef(const ObjRelocationInfo &Rel,
Stubs[Value] = Section.StubOffset;
uint8_t *StubTargetAddr = createStubFunction(Section.Address +
Section.StubOffset);
- AddRelocation(Value, Rel.SectionID, StubTargetAddr - Section.Address,
+ addRelocation(Value, Rel.SectionID, StubTargetAddr - Section.Address,
macho::RIT_Vanilla);
resolveRelocation(Target, (uint64_t)Target,
(uint64_t)Section.Address + Section.StubOffset,
@@ -277,11 +275,12 @@ void RuntimeDyldMachO::processRelocationRef(const ObjRelocationInfo &Rel,
Section.StubOffset += getMaxStubSize();
}
} else
- AddRelocation(Value, Rel.SectionID, Rel.Offset, RelType);
+ addRelocation(Value, Rel.SectionID, Rel.Offset, RelType);
}
-bool RuntimeDyldMachO::isCompatibleFormat(const MemoryBuffer *InputBuffer) const {
+bool RuntimeDyldMachO::isCompatibleFormat(
+ const MemoryBuffer *InputBuffer) const {
StringRef Magic = InputBuffer->getBuffer().slice(0, 4);
if (Magic == "\xFE\xED\xFA\xCE") return true;
if (Magic == "\xCE\xFA\xED\xFE") return true;