Made lldb_private::ArchSpec more generic so that it can take a mach-o cpu
type and sub-type, or an ELF e_machine value. Also added a generic CPU type to the arch spec class so we can have a single arch definition that the LLDB core code can use. Previously a lot of places in the code were using the mach-o definitions from a macosx header file. Switches over to using "llvm/Support/MachO.h" for the llvm::MachO::XXX for the CPU types and sub types for mach-o ArchSpecs. Added "llvm/Support/ELF.h" so we can use the "llvm::ELF::XXX" defines for the ELF ArchSpecs. Got rid of all CPU_TYPE_ and CPU_SUBTYPE_ defines that were previously being used in LLDB. llvm-svn: 105806
This commit is contained in:
@@ -25,8 +25,6 @@
|
||||
|
||||
#define CASE_AND_STREAM(s, def, width) case def: s->Printf("%-*s", width, #def); break;
|
||||
|
||||
static uint32_t ELFMachineToMachCPU(Elf32_Half machine);
|
||||
|
||||
using namespace lldb;
|
||||
using namespace lldb_private;
|
||||
using namespace std;
|
||||
@@ -824,24 +822,6 @@ ObjectFileELF::DumpELFSectionHeaders(Stream *s)
|
||||
}
|
||||
}
|
||||
|
||||
static uint32_t
|
||||
ELFMachineToMachCPU(Elf32_Half machine)
|
||||
{
|
||||
switch (machine)
|
||||
{
|
||||
case EM_SPARC: return CPU_TYPE_SPARC;
|
||||
case EM_386: return CPU_TYPE_I386;
|
||||
case EM_68K: return CPU_TYPE_MC680x0;
|
||||
case EM_88K: return CPU_TYPE_MC88000;
|
||||
case EM_860: return CPU_TYPE_I860;
|
||||
case EM_MIPS: return 8; // commented out in mach/machine.h
|
||||
case EM_PPC: return CPU_TYPE_POWERPC;
|
||||
case EM_PPC64: return CPU_TYPE_POWERPC64;
|
||||
case EM_ARM: return 12; // commented out in mach/machine.h
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
bool
|
||||
ObjectFileELF::GetTargetTriple (ConstString &target_triple)
|
||||
{
|
||||
@@ -866,10 +846,10 @@ ObjectFileELF::GetTargetTriple (ConstString &target_triple)
|
||||
case EM_PPC64: triple.assign("powerpc64-"); break;
|
||||
case EM_ARM: triple.assign("arm-"); break;
|
||||
}
|
||||
// TODO: determine if there is a vendor in the ELF? Default to "apple" for now
|
||||
triple += "apple-";
|
||||
// TODO: determine if there is an OS in the ELF? Default to "darwin" for now
|
||||
triple += "darwin10";
|
||||
// TODO: determine if there is a vendor in the ELF? Default to "linux" for now
|
||||
triple += "linux-";
|
||||
// TODO: determine if there is an OS in the ELF? Default to "gnu" for now
|
||||
triple += "gnu";
|
||||
g_target_triple.SetCString(triple.c_str());
|
||||
target_triple = g_target_triple;
|
||||
}
|
||||
@@ -877,14 +857,6 @@ ObjectFileELF::GetTargetTriple (ConstString &target_triple)
|
||||
}
|
||||
|
||||
|
||||
//bool
|
||||
//ELF32RuntimeFileParser::GetArch(ArchSpec &arch) const
|
||||
//{
|
||||
// arch.SetCPUType(ELFMachineToMachCPU(m_header.e_machine));
|
||||
// arch.SetCPUSubtype(ArchSpec::eAny);
|
||||
// return true;
|
||||
//}
|
||||
|
||||
//------------------------------------------------------------------
|
||||
// PluginInterface protocol
|
||||
//------------------------------------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user