[LLVMdev] Segmentation fault - Kaleidoscope

Xerxes Rånby
2009-06-17T17:33:33Z

Some recent API changes require that the JIT have to be initialized
before use:

#include "llvm/Target/TargetSelect.h"

and use
// If we have a native target, initialize it to ensure it is linked in and
// usable by the JIT.
InitializeNativeTarget();

http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20090615/078885.html


the llvm examples including Kaleidoscope have been changed to use the
jit in this new way:
http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20090615/078888.html


this will fix the 0x0 for EE error.

Xerxes

Den 2009-06-17 18:46, Paul Melis skrev:
> FWIW, I'm also suddenly experiencing segfaults in code that used to
work
> a few days ago (I'm using svn). This may be unrelated to the problem
> described below, but perhaps it's the same thing.
>
> In my case it seems that creating an ExecutionEngine has changed. I used
> to do
>
>      Module* Mod = makeLLVMModule();      // basically create a gcd
function
>      verifyModule(*Mod, PrintMessageAction);
>
>      ExecutionEngine *EE;
>      EE = ExecutionEngine::create(Mod);
>
> but I now get 0x0 for EE. The compile command I'm using is
>
> g++ -O3 -I ~/llvm/include/ -L ~/llvm bug.cpp `llvm-config --cxxflags
> --ldflags --libs core jit native` -o bug
>
> I noticed something very recently changed w.r.t. the way LLVM's
> libraries are built (no more .o files). Could this have something to
> with it?
>
> Regards,
> Paul
>
>
> Juan Carlos Martinez Santos wrote:
>
>> Hello,
>>
>> Following the tutorial "Kaleidoscope: Adding JIT and Optimizer
>> Support", I found a Segmentation fault when I try to execute it. I
am
>> new in the neighbourhood, so I don't know what is wrong. Could you
>> help me with that?
>>
>> I am working with the last version of LLVM (2.5). The code in chapter
>> 2 and 3 works good, but the code in the chapter 4 did not work.
>>
>> Below are the detail of what I did.
>>
>> Regards,
>>
>> Juan Carlos
>>
>> *********************************
>> http://llvm.org/docs/tutorial/LangImpl4.html#jit
>>
>> *********************************
>> ./toy
>> ready>  4+5;
>> Segmentation fault
>>
>> *********************************
>> Details using gdb:
>> *********************************
>> [New Thread 0xb7ca96c0 (LWP 9948)]
>>
>> Program received signal SIGSEGV, Segmentation fault.
>> [Switching to Thread 0xb7ca96c0 (LWP 9948)]
>> 0x0804e914 in main ()
>>      at /usr/local/include/llvm/ExecutionEngine/ExecutionEngine.h:142
>> 142      const TargetData *getTargetData() const { return TD; }
>>
>>
>> --
>> Juan Carlos
>>
------------------------------------------------------------------------
>>
>> _______________________________________________
>> LLVM Developers mailing list
>> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
>> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
>>
>>
>
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL:
<http://lists.llvm.org/pipermail/llvm-dev/attachments/20090617/d4967e52/attachment.html>