diff options
author | Greg Clayton <gclayton@apple.com> | 2010-06-11 03:25:34 +0000 |
---|---|---|
committer | Greg Clayton <gclayton@apple.com> | 2010-06-11 03:25:34 +0000 |
commit | 41f923275eb15ac0b2fc9442f272fd6e4ed8f12a (patch) | |
tree | 51ee99af424e6a63af024889f2550151c3d5957e /lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp | |
parent | 9af2d4a6141c4bad8a9e53912469b5ff13079464 (diff) | |
download | bcm5719-llvm-41f923275eb15ac0b2fc9442f272fd6e4ed8f12a.tar.gz bcm5719-llvm-41f923275eb15ac0b2fc9442f272fd6e4ed8f12a.zip |
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
Diffstat (limited to 'lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp')
-rw-r--r-- | lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp | 36 |
1 files changed, 4 insertions, 32 deletions
diff --git a/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp b/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp index b34dd3db289..6a5b5f32eb6 100644 --- a/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp +++ b/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp @@ -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 //------------------------------------------------------------------ |