From bd58871d9688420999fc1308eb5af5f5ee8dab3e Mon Sep 17 00:00:00 2001 From: Stephen Wilson Date: Thu, 24 Feb 2011 19:15:09 +0000 Subject: [PATCH] Host: linux: Use llvm::sys::getHostTriple for the default host ArchSpec. Previously we were using a set of preprocessor defines and returning an ArchSpec without any OS/Vendor information. This fixes an issue with plugin resolution on Linux where a valid OS component is needed. llvm-svn: 126404 --- lldb/source/Host/common/Host.cpp | 45 ++++++++++++++++---------------- 1 file changed, 22 insertions(+), 23 deletions(-) diff --git a/lldb/source/Host/common/Host.cpp b/lldb/source/Host/common/Host.cpp index 98e5b95cce45..cb6a3cf97f10 100644 --- a/lldb/source/Host/common/Host.cpp +++ b/lldb/source/Host/common/Host.cpp @@ -18,6 +18,8 @@ #include "lldb/Host/Endian.h" #include "lldb/Host/Mutex.h" +#include "llvm/Support/Host.h" + #include #include @@ -288,34 +290,31 @@ Host::GetArchitecture (SystemDefaultArchitecture arch_kind) } #else // #if defined (__APPLE__) - + if (g_supports_32 == false && g_supports_64 == false) { -#if defined (__x86_64__) + llvm::Triple triple(llvm::sys::getHostTriple()); - g_host_arch_64.SetTriple ("x86_64"); + g_host_arch_32.Clear(); + g_host_arch_64.Clear(); -#elif defined (__i386__) + switch (triple.getArch()) + { + default: + g_host_arch_32.SetTriple(triple); + g_supports_32 = true; + break; - g_host_arch_32.SetTriple ("i386"); - -#elif defined (__arm__) - - g_host_arch_32.SetTriple ("arm"); - -#elif defined (__ppc64__) - - g_host_arch_64.SetTriple ("ppc64"); - -#elif defined (__powerpc__) || defined (__ppc__) - - g_host_arch_32.SetTriple ("ppc"); - -#else - -#error undefined architecture, define your architecture here - -#endif + case llvm::Triple::alpha: + case llvm::Triple::x86_64: + case llvm::Triple::sparcv9: + case llvm::Triple::ppc64: + case llvm::Triple::systemz: + case llvm::Triple::cellspu: + g_host_arch_64.SetTriple(triple); + g_supports_64 = true; + break; + } g_supports_32 = g_host_arch_32.IsValid(); g_supports_64 = g_host_arch_64.IsValid();