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

Weiss, Eran Eran.Weiss at emc.com
Sun Oct 7 01:30:08 PDT 2012


I've attached the patch, as well as test case. Note that the test case is
written for 64 bit mac, but can be easily converted to other 64 bit
platforms.

On 03/10/2012 04:36, "David Blaikie" <dblaikie at gmail.com> wrote:

>Could you provide a test case as well? & usually patches are sent as
>attachments, rather than inline (to avoid any possible issues with
>mail clients line wrapping content, etc)
>
>On Mon, Sep 24, 2012 at 1:36 AM, Weiss, Eran <Eran.Weiss at emc.com> wrote:
>> 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;
>>
>>
>> _______________________________________________
>> llvm-commits mailing list
>> llvm-commits at cs.uiuc.edu
>> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>>
>

-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: patch.txt
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20121007/2a33a652/attachment.txt>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: test_case_mac_64.c
Type: application/octet-stream
Size: 3101 bytes
Desc: test_case_mac_64.c
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20121007/2a33a652/attachment.obj>


More information about the llvm-commits mailing list