summaryrefslogtreecommitdiffstats
path: root/lib/ExecutionEngine
diff options
context:
space:
mode:
authorBob Wilson <bob.wilson@apple.com>2012-12-05 19:09:13 +0000
committerBob Wilson <bob.wilson@apple.com>2012-12-05 19:09:13 +0000
commite1fd317a4c92d16b619bb01fcbcf8d031d28cf36 (patch)
tree1fb89c6db165d93578b6a02df4c17a5988d07a83 /lib/ExecutionEngine
parent73714eac00958b072e7356360ebc6e818b51367b (diff)
downloadexternal_llvm-e1fd317a4c92d16b619bb01fcbcf8d031d28cf36.zip
external_llvm-e1fd317a4c92d16b619bb01fcbcf8d031d28cf36.tar.gz
external_llvm-e1fd317a4c92d16b619bb01fcbcf8d031d28cf36.tar.bz2
Adjust JIT target triple on OS X to match the current architecture.
For OS X builds, we generate one version of config.h but then build for multiple architectures. This means that the LLVM_HOSTTRIPLE setting may have the wrong architecture. Adjust it dynamically to match the current architecture. <rdar://problem/12715470> git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@169405 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/ExecutionEngine')
-rw-r--r--lib/ExecutionEngine/TargetSelect.cpp12
1 files changed, 11 insertions, 1 deletions
diff --git a/lib/ExecutionEngine/TargetSelect.cpp b/lib/ExecutionEngine/TargetSelect.cpp
index f33cc54..4e52a98 100644
--- a/lib/ExecutionEngine/TargetSelect.cpp
+++ b/lib/ExecutionEngine/TargetSelect.cpp
@@ -32,8 +32,18 @@ TargetMachine *EngineBuilder::selectTarget() {
// must use the host architecture.
if (UseMCJIT && WhichEngine != EngineKind::Interpreter && M)
TT.setTriple(M->getTargetTriple());
- else
+ else {
TT.setTriple(LLVM_HOSTTRIPLE);
+#if defined(__APPLE__)
+#if defined(__LP64__)
+ if (TT.isArch32Bit())
+ TT = TT.get64BitArchVariant();
+#else
+ if (TT.isArch64Bit())
+ TT = TT.get32BitArchVariant();
+#endif
+#endif // APPLE
+ }
return selectTarget(TT, MArch, MCPU, MAttrs);
}