summaryrefslogtreecommitdiffstats
path: root/lld/lib/ReaderWriter/MachO/ArchHandler_x86_64.cpp
diff options
context:
space:
mode:
authorJean-Daniel Dupas <devlists@shadowlab.org>2015-02-15 15:23:48 +0000
committerJean-Daniel Dupas <devlists@shadowlab.org>2015-02-15 15:23:48 +0000
commit9c222630e4c9c20eeaaa03ece4f0c2da56ea711c (patch)
tree47657f5d081273ae8382829b38489dc7ad6f4c4d /lld/lib/ReaderWriter/MachO/ArchHandler_x86_64.cpp
parent5a6375c3ba3b40af3e1df961c4ffc930a47b497e (diff)
downloadbcm5719-llvm-9c222630e4c9c20eeaaa03ece4f0c2da56ea711c.tar.gz
bcm5719-llvm-9c222630e4c9c20eeaaa03ece4f0c2da56ea711c.zip
Update ARM and x86 ArchHandler to check switch completeness. NFC
Define an explicit type for arch specific reference kinds to make sure all cases are covered in switch statements. llvm-svn: 229314
Diffstat (limited to 'lld/lib/ReaderWriter/MachO/ArchHandler_x86_64.cpp')
-rw-r--r--lld/lib/ReaderWriter/MachO/ArchHandler_x86_64.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/lld/lib/ReaderWriter/MachO/ArchHandler_x86_64.cpp b/lld/lib/ReaderWriter/MachO/ArchHandler_x86_64.cpp
index 29a448ca170..169315e8b07 100644
--- a/lld/lib/ReaderWriter/MachO/ArchHandler_x86_64.cpp
+++ b/lld/lib/ReaderWriter/MachO/ArchHandler_x86_64.cpp
@@ -475,11 +475,11 @@ void ArchHandler_x86_64::applyFixupFinal(
const Reference &ref, uint8_t *loc, uint64_t fixupAddress,
uint64_t targetAddress, uint64_t inAtomAddress, uint64_t imageBaseAddress,
FindAddressForAtom findSectionAddress) {
- ulittle32_t *loc32 = reinterpret_cast<ulittle32_t *>(loc);
- ulittle64_t *loc64 = reinterpret_cast<ulittle64_t *>(loc);
if (ref.kindNamespace() != Reference::KindNamespace::mach_o)
return;
assert(ref.kindArch() == Reference::KindArch::x86_64);
+ ulittle32_t *loc32 = reinterpret_cast<ulittle32_t *>(loc);
+ ulittle64_t *loc64 = reinterpret_cast<ulittle64_t *>(loc);
switch (static_cast<X86_64_Kinds>(ref.kindValue())) {
case branch32:
case ripRel32:
@@ -548,6 +548,9 @@ void ArchHandler_x86_64::applyFixupRelocatable(const Reference &ref,
uint64_t fixupAddress,
uint64_t targetAddress,
uint64_t inAtomAddress) {
+ if (ref.kindNamespace() != Reference::KindNamespace::mach_o)
+ return;
+ assert(ref.kindArch() == Reference::KindArch::x86_64);
ulittle32_t *loc32 = reinterpret_cast<ulittle32_t *>(loc);
ulittle64_t *loc64 = reinterpret_cast<ulittle64_t *>(loc);
switch (static_cast<X86_64_Kinds>(ref.kindValue())) {
OpenPOWER on IntegriCloud