[LLVMbugs] [Bug 12197] New: JIT::getPointerToFunctionOrStub() return illegal stub in non-lazy case

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Tue Mar 6 14:58:31 PST 2012


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: unassignedbugs at nondot.org
        ReportedBy: hammacher at cs.uni-saarland.de
                CC: llvmbugs at cs.uiuc.edu
    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.



More information about the llvm-bugs mailing list