forked from OSchip/llvm-project
Allow command-line overrides of the target triple with the Mach-O
disassembler, just like the generic disassembler. llvm-svn: 149681
This commit is contained in:
parent
d5ffe0900d
commit
88cc16aeb5
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue