diff options
author | Cameron Zwarich <zwarich@apple.com> | 2012-02-03 06:35:22 +0000 |
---|---|---|
committer | Cameron Zwarich <zwarich@apple.com> | 2012-02-03 06:35:22 +0000 |
commit | a99350511cceb8a723800957bae500078f054062 (patch) | |
tree | 9b09fe175886c5ee4ba9c92a3ce06f0744f72a85 /tools | |
parent | fa5b70e1d8856a2e52444ac82fa641d20276280c (diff) | |
download | external_llvm-a99350511cceb8a723800957bae500078f054062.zip external_llvm-a99350511cceb8a723800957bae500078f054062.tar.gz external_llvm-a99350511cceb8a723800957bae500078f054062.tar.bz2 |
Allow command-line overrides of the target triple with the Mach-O
disassembler, just like the generic disassembler.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@149681 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'tools')
-rw-r--r-- | tools/llvm-objdump/MachODump.cpp | 39 |
1 files changed, 20 insertions, 19 deletions
diff --git a/tools/llvm-objdump/MachODump.cpp b/tools/llvm-objdump/MachODump.cpp index 6ea0323..272dedf 100644 --- a/tools/llvm-objdump/MachODump.cpp +++ b/tools/llvm-objdump/MachODump.cpp @@ -53,27 +53,28 @@ static cl::opt<std::string> static const Target *GetTarget(const MachOObject *MachOObj) { // Figure out the target triple. - llvm::Triple TT("unknown-unknown-unknown"); - switch (MachOObj->getHeader().CPUType) { - case llvm::MachO::CPUTypeI386: - TT.setArch(Triple::ArchType(Triple::x86)); - break; - case llvm::MachO::CPUTypeX86_64: - TT.setArch(Triple::ArchType(Triple::x86_64)); - break; - case llvm::MachO::CPUTypeARM: - TT.setArch(Triple::ArchType(Triple::arm)); - break; - case llvm::MachO::CPUTypePowerPC: - TT.setArch(Triple::ArchType(Triple::ppc)); - break; - case llvm::MachO::CPUTypePowerPC64: - TT.setArch(Triple::ArchType(Triple::ppc64)); - break; + if (TripleName.empty()) { + llvm::Triple TT("unknown-unknown-unknown"); + switch (MachOObj->getHeader().CPUType) { + case llvm::MachO::CPUTypeI386: + TT.setArch(Triple::ArchType(Triple::x86)); + break; + case llvm::MachO::CPUTypeX86_64: + TT.setArch(Triple::ArchType(Triple::x86_64)); + break; + case llvm::MachO::CPUTypeARM: + TT.setArch(Triple::ArchType(Triple::arm)); + break; + case llvm::MachO::CPUTypePowerPC: + TT.setArch(Triple::ArchType(Triple::ppc)); + break; + case llvm::MachO::CPUTypePowerPC64: + TT.setArch(Triple::ArchType(Triple::ppc64)); + break; + } + TripleName = TT.str(); } - TripleName = TT.str(); - // Get the target specific parser. std::string Error; const Target *TheTarget = TargetRegistry::lookupTarget(TripleName, Error); |