[llvm-commits] llvm-c ignores module Triple arch. patch

Weiss, Eran Eran.Weiss at emc.com
Mon Sep 24 01:36:36 PDT 2012


Hi,

I've fixed a bug in llvm-c api - LLVMCreateJITCompilerForModule specifically. It ignored the triple from the module, which caused the JIT to always use the default triple. That crashed when running on x86_64 in x86 mode.
For more details: http://llvm.org/bugs/show_bug.cgi?id=13833.
svn diff follows.

Eran.

Index: lib/ExecutionEngine/ExecutionEngineBindings.cpp
===================================================================
--- lib/ExecutionEngine/ExecutionEngineBindings.cpp (revision 164482)
+++ lib/ExecutionEngine/ExecutionEngineBindings.cpp (working copy)
@@ -13,6 +13,7 @@

 #define DEBUG_TYPE "jit"
 #include "llvm-c/ExecutionEngine.h"
+#include "llvm/ADT/Triple.h"
 #include "llvm/ExecutionEngine/GenericValue.h"
 #include "llvm/ExecutionEngine/ExecutionEngine.h"
 #include "llvm/Support/ErrorHandling.h"
@@ -123,7 +124,8 @@
   EngineBuilder builder(unwrap(M));
   builder.setEngineKind(EngineKind::JIT)
          .setErrorStr(&Error)
-         .setOptLevel((CodeGenOpt::Level)OptLevel);
+         .setOptLevel((CodeGenOpt::Level)OptLevel)
+         .setMArch(Triple(unwrap(M)->getTargetTriple()).getArchName());
   if (ExecutionEngine *JIT = builder.create()) {
     *OutJIT = wrap(JIT);
     return 0;

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20120924/7696fe3c/attachment.html>


More information about the llvm-commits mailing list