[Lldb-commits] [PATCH 2/4] Host: linux: Use llvm::sys::getHostTriple for the default host ArchSpec.
Greg Clayton
gclayton at apple.com
Wed Feb 23 15:57:09 PST 2011
Looks good.
On Feb 23, 2011, at 1:16 PM, Stephen Wilson wrote:
> 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.
> ---
> source/Host/common/Host.cpp | 47 +++++++++++++++++++++----------------------
> 1 files changed, 23 insertions(+), 24 deletions(-)
>
> diff --git a/source/Host/common/Host.cpp b/source/Host/common/Host.cpp
> index 98e5b95..1f48b20 100644
> --- a/source/Host/common/Host.cpp
> +++ b/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 <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__)
> -
> - 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();
> --
> 1.7.3.5
>
> _______________________________________________
> lldb-commits mailing list
> lldb-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits
More information about the lldb-commits
mailing list