[LLVMbugs] [Bug 5649] New: examples/fibonacci doesn't register any JIT targets

bugzilla-daemon at cs.uiuc.edu bugzilla-daemon at cs.uiuc.edu
Mon Nov 30 14:48:49 PST 2009


           Summary: examples/fibonacci doesn't register any JIT targets
           Product: new-bugs
           Version: 2.6
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: minor
          Priority: P2
         Component: new bugs
        AssignedTo: unassignedbugs at nondot.org
        ReportedBy: isomer at gmail.com
                CC: llvmbugs at cs.uiuc.edu

Created an attachment (id=3892)
 --> (http://llvm.org/bugs/attachment.cgi?id=3892)
Patch to register targets, force JIT, and produce a human readable error if it
goes wrong.

examples/Fibonacci.cpp is an example demonstrating JIT, however it doesn't call
InitializeNativeTarget(); and thus will always end up falling back on the

This can be verified with changing:
  ExecutionEngine *EE = EngineBuilder(M).create();
  std::string errStr;
  ExecutionEngine *EE =

  if (!EE) {
    errs() << argv[0] << ": Failed to construct ExecutionEngine: " << errStr <<
    return 1;

This produces the error:
 ./fibonacci: Failed to construct ExecutionEngine: Unable to find target for
this  triple (no targets are registered)

This can be fixed by adding the line:
and adding the include:
  #include "llvm/Target/TargetSelect.h"

As examples/fibonacci is in theory an example on using JIT, not registering any
JIT targets seems to be an "ugly blunder".

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