<html>
    <head>
      <base href="http://llvm.org/bugs/" />
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW --- - bitcode can't be executed by MCJIT on ios (arm64)"
   href="http://llvm.org/bugs/show_bug.cgi?id=21012">21012</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>bitcode can't be executed by MCJIT on ios (arm64)
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>new-bugs
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>trunk
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>other
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>new bugs
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>dev@antonsmirnov.name
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvmbugs@cs.uiuc.edu
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Created <span class=""><a href="attachment.cgi?id=13057" name="attach_13057" title="archive">attachment 13057</a> <a href="attachment.cgi?id=13057&action=edit" title="archive">[details]</a></span>
archive

I've created static lib (using lli source code) to execute LLVM bitcode from
ios app.

I've bundle ready LLVM bitcode file (.ll) in app bundle (targeted to
arm64-apple-ios7.1) and it seems to be correct.

When i try to execute code it crashes in ExecutionEngine.cpp in line:
return runFunction(Fn, GVArgs).IntVal.getZExtValue();

with EXC_BAD_ACCESS (code=260, address=0xd10083ff).

The app should be linked with libclang*.a and libLLVM*.a which are
cross-compiled for armv7.

In order to reproduce the case i attach zip with:
* bug_scr - screenshot of exception in xcode
* build_executor.sh script (to build executor static lib)
* lib_interpreter.cpp/.h which is static lib (code copy-pasted from lli source
code but change InitializeNative* to InitializeAll*)
* LLVMExecutorDemo - ios app to test

Workflow:
1. cross-compile LLVM for ARM (with XCode tooolchain).
i've used --prefix=... --host=i386-apple-darwin11 --enable-threads=no
--disable-threads --disable-terminfo --enable-languages=c,c++ -—enable-zlib=no
—-disable-zlib
configure arguments
2. cross-compile my static lib (use ./build_executor.sh script and change paths
to y ours)
3. compile ios app (and change lib*.a paths to yours)
4. run and see exception
5. fix it ;)</pre>
        </div>
      </p>
      <hr>
      <span>You are receiving this mail because:</span>
      
      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>