[Lldb-commits] [lldb] r126404 - /lldb/trunk/source/Host/common/Host.cpp
Stephen Wilson
wilsons at start.ca
Thu Feb 24 11:15:09 PST 2011
Author: wilsons
Date: Thu Feb 24 13:15:09 2011
New Revision: 126404
URL: http://llvm.org/viewvc/llvm-project?rev=126404&view=rev
Log:
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.
Modified:
lldb/trunk/source/Host/common/Host.cpp
Modified: lldb/trunk/source/Host/common/Host.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/common/Host.cpp?rev=126404&r1=126403&r2=126404&view=diff
==============================================================================
--- lldb/trunk/source/Host/common/Host.cpp (original)
+++ lldb/trunk/source/Host/common/Host.cpp Thu Feb 24 13:15:09 2011
@@ -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 @@
}
#else // #if defined (__APPLE__)
-
+
if (g_supports_32 == false && g_supports_64 == false)
{
-#if defined (__x86_64__)
-
- g_host_arch_64.SetTriple ("x86_64");
-
-#elif defined (__i386__)
-
- g_host_arch_32.SetTriple ("i386");
-
-#elif defined (__arm__)
-
- g_host_arch_32.SetTriple ("arm");
-
-#elif defined (__ppc64__)
+ llvm::Triple triple(llvm::sys::getHostTriple());
- g_host_arch_64.SetTriple ("ppc64");
+ g_host_arch_32.Clear();
+ g_host_arch_64.Clear();
-#elif defined (__powerpc__) || defined (__ppc__)
-
- g_host_arch_32.SetTriple ("ppc");
-
-#else
-
-#error undefined architecture, define your architecture here
-
-#endif
+ switch (triple.getArch())
+ {
+ default:
+ g_host_arch_32.SetTriple(triple);
+ g_supports_32 = true;
+ break;
+
+ 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();
More information about the lldb-commits
mailing list