[LLVMdev] 2.6/trunk Execution Engine question

Kenneth Uildriks kennethuil at gmail.com
Tue Oct 6 15:08:51 PDT 2009


On Tue, Oct 6, 2009 at 4:15 PM, Reid Kleckner <rnk at mit.edu> wrote:
>> 6. When ExecutionEngine::create was called with parameter
>> "GVsWithCode" set to its default value of true, I got a segfault when
>> trying to get a pointer to one of my globals.  JIT::getMemoryForGV was
>> returning NULL in that case.  Explicitly passing false for
>> "GVsWithCode" cleared it up.
>
> That's no good.  Could you send me a stack trace and explain how you
> got that to happen?  I was the last one to touch that code.

Stack trace attached.  It's not very informative; it just tells us
that it's got a null pointer that it thinks is a pointer to the
global, and it's trying to initialize that global.

What I did was load a module from a MemoryBuffer, use an
ExistingModuleProvider to feed it to the ExecutionEngine, then start
looping through its globals and get their addresses so I can refer to
their values while compiling another module.  The segfault happened on
the first one it encountered, a linkonce constant int32.

I can try and reduce it for you if you need.  The comment above create
said that passing true was "unsafe", so I figured it was a known issue
and plowed ahead with the upgrade.
-------------- next part --------------

#0  0xb7d4cc1c in memcpy () from /lib/i686/cmov/libc.so.6
#1  0x08851ead in StoreIntToMemory (IntVal=@0xbfe685b0, Dst=0x0, StoreBytes=4)
    at ExecutionEngine.cpp:783
#2  0x08851f7d in llvm::ExecutionEngine::StoreValueToMemory (this=0x97596f8,
    Val=@0xbfe685a8, Ptr=0x0, Ty=0x970e5f4) at ExecutionEngine.cpp:809
#3  0x88542a8 in llvm::ExecutionEngine::InitializeMemory (this=0x97596f8,
    Init=0x9732d70, Addr=0x0) at ExecutionEngine.cpp:931
#4  0x0885471c in llvm::ExecutionEngine::EmitGlobalVariable (this=0x97596f8,
    GV=0x981d7a4) at ExecutionEngine.cpp:1062
#5  0x08855169 in llvm::ExecutionEngine::getPointerToGlobal (this=0x97596f8,
    GV=0x981d7a4) at ExecutionEngine.cpp:481


More information about the llvm-dev mailing list