summaryrefslogtreecommitdiffstats
path: root/llvm/lib/ExecutionEngine/RuntimeDyld/Targets
diff options
context:
space:
mode:
authorLang Hames <lhames@gmail.com>2015-10-19 20:37:52 +0000
committerLang Hames <lhames@gmail.com>2015-10-19 20:37:52 +0000
commitf1381cb8d09aaf95fe327f059f16e210776919b2 (patch)
tree2d8a9dc0dcc377c935667caffdb0b8617a26f7fe /llvm/lib/ExecutionEngine/RuntimeDyld/Targets
parentb7f2867a85f2fc47a6dac5366bb2acd03d9db0d7 (diff)
downloadbcm5719-llvm-f1381cb8d09aaf95fe327f059f16e210776919b2.tar.gz
bcm5719-llvm-f1381cb8d09aaf95fe327f059f16e210776919b2.zip
[RuntimeDyld][COFF] Fix some endianness issues, re-enable the regression test.
llvm-svn: 250733
Diffstat (limited to 'llvm/lib/ExecutionEngine/RuntimeDyld/Targets')
-rw-r--r--llvm/lib/ExecutionEngine/RuntimeDyld/Targets/RuntimeDyldCOFFX86_64.h17
1 files changed, 7 insertions, 10 deletions
diff --git a/llvm/lib/ExecutionEngine/RuntimeDyld/Targets/RuntimeDyldCOFFX86_64.h b/llvm/lib/ExecutionEngine/RuntimeDyld/Targets/RuntimeDyldCOFFX86_64.h
index 8b7d06930a1..adaeae0702e 100644
--- a/llvm/lib/ExecutionEngine/RuntimeDyld/Targets/RuntimeDyldCOFFX86_64.h
+++ b/llvm/lib/ExecutionEngine/RuntimeDyld/Targets/RuntimeDyldCOFFX86_64.h
@@ -72,7 +72,6 @@ public:
case COFF::IMAGE_REL_AMD64_REL32_3:
case COFF::IMAGE_REL_AMD64_REL32_4:
case COFF::IMAGE_REL_AMD64_REL32_5: {
- uint32_t *TargetAddress = (uint32_t *)Target;
uint64_t FinalAddress = Section.LoadAddress + RE.Offset;
// Delta is the distance from the start of the reloc to the end of the
// instruction with the reloc.
@@ -81,7 +80,7 @@ public:
uint64_t Result = Value + RE.Addend;
assert(((int64_t)Result <= INT32_MAX) && "Relocation overflow");
assert(((int64_t)Result >= INT32_MIN) && "Relocation underflow");
- *TargetAddress = Result;
+ writeBytesUnaligned(Result, Target, 4);
break;
}
@@ -92,14 +91,12 @@ public:
// within a 32 bit offset from the base.
//
// For now we just set these to zero.
- uint32_t *TargetAddress = (uint32_t *)Target;
- *TargetAddress = 0;
+ writeBytesUnaligned(0, Target, 4);
break;
}
case COFF::IMAGE_REL_AMD64_ADDR64: {
- uint64_t *TargetAddress = (uint64_t *)Target;
- *TargetAddress = Value + RE.Addend;
+ writeBytesUnaligned(0, Target, Value + RE.Addend);
break;
}
@@ -139,14 +136,14 @@ public:
case COFF::IMAGE_REL_AMD64_REL32_4:
case COFF::IMAGE_REL_AMD64_REL32_5:
case COFF::IMAGE_REL_AMD64_ADDR32NB: {
- uint32_t *Displacement = (uint32_t *)ObjTarget;
- Addend = *Displacement;
+ uint8_t *Displacement = (uint8_t *)ObjTarget;
+ Addend = readBytesUnaligned(Displacement, 4);
break;
}
case COFF::IMAGE_REL_AMD64_ADDR64: {
- uint64_t *Displacement = (uint64_t *)ObjTarget;
- Addend = *Displacement;
+ uint8_t *Displacement = (uint8_t *)ObjTarget;
+ Addend = readBytesUnaligned(Displacement, 8);
break;
}
OpenPOWER on IntegriCloud