Enhance host bcc to allow cross-compilation (eg. debug arm codegen on host):
eg. bcc -C armv7-none-linux-gnueabi # generate ARMv7
bcc -C i686-unknown-linux # generate x86 (default on Goobuntu)
Other targets are not supported at this moment.
Change-Id: If2f1199656664327cf35cf6a3670136f48c42cad
diff --git a/lib/ExecutionEngine/Compiler.cpp b/lib/ExecutionEngine/Compiler.cpp
index dd370d9..4351079 100644
--- a/lib/ExecutionEngine/Compiler.cpp
+++ b/lib/ExecutionEngine/Compiler.cpp
@@ -91,6 +91,20 @@
bool Compiler::GlobalInitialized = false;
+
+#if !defined(__HOST__)
+ #define TARGET_TRIPLE_STRING DEFAULT_TARGET_TRIPLE_STRING
+#else
+// In host TARGET_TRIPLE_STRING is a variable to allow cross-compilation.
+ #if defined(__cplusplus)
+ extern "C" {
+ #endif
+ char *TARGET_TRIPLE_STRING = (char*)DEFAULT_TARGET_TRIPLE_STRING;
+ #if defined(__cplusplus)
+ };
+ #endif
+#endif
+
// Code generation optimization level for the compiler
llvm::CodeGenOpt::Level Compiler::CodeGenOptLevel;