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
This commit is contained in:
Stephen Wilson 2011-02-24 19:15:09 +00:00
parent facebfc354
commit bd58871d96
1 changed files with 22 additions and 23 deletions

View File

@ -18,6 +18,8 @@
#include "lldb/Host/Endian.h"
#include "lldb/Host/Mutex.h"
#include "llvm/Support/Host.h"
#include <dlfcn.h>
#include <errno.h>
@ -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();