From 03c1f4330495df2682c3571c8eb45e9ca6b10c9b Mon Sep 17 00:00:00 2001 From: Joshua Warner Date: Mon, 6 Oct 2014 11:01:18 -0600 Subject: [PATCH] make x86 backend build on arm --- src/codegen/target/x86/detect.cpp | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/codegen/target/x86/detect.cpp b/src/codegen/target/x86/detect.cpp index d6c9f1fc06..03824b96de 100644 --- a/src/codegen/target/x86/detect.cpp +++ b/src/codegen/target/x86/detect.cpp @@ -13,6 +13,10 @@ #include "context.h" +// Note: this is so that we can build the x86 backend(s) on an arm machine. +// This way, we could (in theory) do a bootimage cross-compile from arm to x86 +#ifndef __arm__ + #ifndef _MSC_VER #include #else @@ -37,7 +41,9 @@ static int __get_cpuid(unsigned int __level, #define bit_SSE (1 << 25) #define bit_SSE2 (1 << 26) -#endif +#endif // ndef _MSC_VER + +#endif // ndef __arm__ namespace avian { namespace codegen { @@ -49,6 +55,10 @@ namespace x86 { bool useSSE(ArchitectureContext* c) { +#ifdef __arm__ + // We can't link in the detection code on arm (DUH!) + return vm::TargetBytesPerWord == 8; +#else if (vm::TargetBytesPerWord == 8) { // amd64 implies SSE2 support return true; @@ -65,6 +75,7 @@ bool useSSE(ArchitectureContext* c) } else { return false; } +#endif } } // namespace x86