http://llvm.org/bugs/show_bug.cgi?id=12197

             Bug #: 12197
           Summary: JIT::getPointerToFunctionOrStub() return illegal stub
                    in non-lazy case
           Product: libraries
           Version: trunk
          Platform: PC
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: Target-Independent JIT
        AssignedTo: [email protected]
        ReportedBy: [email protected]
                CC: [email protected]
    Classification: Unclassified


When calling JIT::getPointerToFunctionOrStub on a function which has no global
mapping yet, a stub is created by calling getLazyFunctionStub on the
JITResolver.
If the JIT is non-lazy, this call creates a stub jumping to 0x0, and adds the
function to the pending functions list, but this list is not processed before
returning the (still illegal) stub.

Reproduction: In the HowToUseJIT example, add a call to
EE->getPointerToFunctionOrStub before the EE->runFunction call.

diff --git a/examples/HowToUseJIT/HowToUseJIT.cpp
b/examples/HowToUseJIT/HowToUseJIT.cpp
index 92b2860..662ed22 100644
--- a/examples/HowToUseJIT/HowToUseJIT.cpp
+++ b/examples/HowToUseJIT/HowToUseJIT.cpp
@@ -123,4 +123,5 @@ int main() {
   // Call the `foo' function with no arguments:
   std::vector<GenericValue> noargs;
+  EE->getPointerToFunctionOrStub(FooF);
   GenericValue gv = EE->runFunction(FooF, noargs);

-- 
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.
_______________________________________________
LLVMbugs mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs

Reply via email to