[LLVMbugs] [Bug 13515] New: JIT::runFunction() creates stubs with internal linkage

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Thu Aug 2 08:13:35 PDT 2012


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

             Bug #: 13515
           Summary: JIT::runFunction() creates stubs with internal linkage
           Product: libraries
           Version: trunk
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: Target-Independent JIT
        AssignedTo: unassignedbugs at nondot.org
        ReportedBy: nunoplopes at sapo.pt
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified


JIT::runFunction() creates stubs with internal linkage:

"
  // First, create the function.
  FunctionType *STy=FunctionType::get(RetTy, false);
  Function *Stub = Function::Create(STy, Function::InternalLinkage, "",
                                    F->getParent());
"

However, this is not fine when the executed function calls certain module
passes, like the inliner. The inliner removes all unreachable internal
functions, and therefore the stub function will be deleted before it returns,
thus leading to crashes.

I can see two solutions:
 - create stubs with external linkage
 - add the stubs to @llvm.compiler.used

Probably the 2nd solution is overkill, and I can't see any real drawback of
solution 1).

MCJIT doesn't implement a fallback mechanism for the fast-path yet, so it
doesn't suffer from this bug.

-- 
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