diff options
| author | Nick Kledzik <kledzik@apple.com> | 2014-07-16 19:49:02 +0000 |
|---|---|---|
| committer | Nick Kledzik <kledzik@apple.com> | 2014-07-16 19:49:02 +0000 |
| commit | 2458bec7e740643bdfa3c0e89d60704e225b78cb (patch) | |
| tree | 70f5db902303075775247b5b27109a135744110a /lld/lib/ReaderWriter/MachO/MachONormalizedFileBinaryReader.cpp | |
| parent | ac451066f48820a0be4bccba0a64b7c2e2dc0c35 (diff) | |
| download | bcm5719-llvm-2458bec7e740643bdfa3c0e89d60704e225b78cb.tar.gz bcm5719-llvm-2458bec7e740643bdfa3c0e89d60704e225b78cb.zip | |
[mach-o] refactor KindHandler into ArchHandler and simplify passes.
All architecture specific handling is now done in the appropriate
ArchHandler subclass.
The StubsPass and GOTPass have been simplified. All architecture specific
variations in stubs are now encoded in a table which is vended by the
current ArchHandler.
llvm-svn: 213187
Diffstat (limited to 'lld/lib/ReaderWriter/MachO/MachONormalizedFileBinaryReader.cpp')
| -rw-r--r-- | lld/lib/ReaderWriter/MachO/MachONormalizedFileBinaryReader.cpp | 28 |
1 files changed, 7 insertions, 21 deletions
diff --git a/lld/lib/ReaderWriter/MachO/MachONormalizedFileBinaryReader.cpp b/lld/lib/ReaderWriter/MachO/MachONormalizedFileBinaryReader.cpp index 7c599152e8b..c96f325173c 100644 --- a/lld/lib/ReaderWriter/MachO/MachONormalizedFileBinaryReader.cpp +++ b/lld/lib/ReaderWriter/MachO/MachONormalizedFileBinaryReader.cpp @@ -22,8 +22,10 @@ /// +------------+ #include "MachONormalizedFile.h" + +#include "ArchHandler.h" #include "MachONormalizedFileBinaryUtils.h" -#include "ReferenceKinds.h" + #include "lld/Core/Error.h" #include "lld/Core/LLVM.h" #include "llvm/ADT/SmallString.h" @@ -442,27 +444,11 @@ private: } // namespace normalized } // namespace mach_o -void Registry::addSupportMachOObjects(StringRef archName) { - MachOLinkingContext::Arch arch = MachOLinkingContext::archFromName(archName); +void Registry::addSupportMachOObjects(const MachOLinkingContext &ctx) { + MachOLinkingContext::Arch arch = ctx.arch(); add(std::unique_ptr<Reader>(new mach_o::normalized::MachOReader(arch))); - switch (arch) { - case MachOLinkingContext::arch_x86_64: - addKindTable(Reference::KindNamespace::mach_o, Reference::KindArch::x86_64, - mach_o::KindHandler_x86_64::kindStrings); - break; - case MachOLinkingContext::arch_x86: - addKindTable(Reference::KindNamespace::mach_o, Reference::KindArch::x86, - mach_o::KindHandler_x86::kindStrings); - break; - case MachOLinkingContext::arch_armv6: - case MachOLinkingContext::arch_armv7: - case MachOLinkingContext::arch_armv7s: - addKindTable(Reference::KindNamespace::mach_o, Reference::KindArch::ARM, - mach_o::KindHandler_arm::kindStrings); - break; - default: - llvm_unreachable("mach-o arch not supported"); - } + addKindTable(Reference::KindNamespace::mach_o, ctx.archHandler().kindArch(), + ctx.archHandler().kindStrings()); add(std::unique_ptr<YamlIOTaggedDocumentHandler>( new mach_o::MachOYamlIOTaggedDocumentHandler(arch))); } |

