<html>
    <head>
      <base href="https://bugs.llvm.org/">
    </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 - Cannot use object files with OrcJIT on MacOS"
   href="https://bugs.llvm.org/show_bug.cgi?id=35370">35370</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Cannot use object files with OrcJIT on MacOS
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>libraries
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>5.0
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>Macintosh
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>MacOS X
          </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>OrcJIT
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>1101.debian@gmail.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Created <span class=""><a href="attachment.cgi?id=19449" name="attach_19449" title="JIT runner source code">attachment 19449</a> <a href="attachment.cgi?id=19449&action=edit" title="JIT runner source code">[details]</a></span>
JIT runner source code

I made a simple JIT runner and now I am trying to feed it with an object file.
When I attempt to run 'main' then it crashes.
Even though it works just fine on Linux (tested on Ubuntu 16.04 32bit).

I attach my simple JIT runner as a main.cpp.
I built it using LLVM 5.0 official prebuilt binaries. I used the following
command:

clang++ `llvm-config --cxxflags` `llvm-config --libs` -lz -lncurses main.cpp -o
jitter

The I just built 'hello world' program:

clang++ -c main.cpp

And fed it to the jitter:

./jitter main.o

This is the trace I obtained from lldb:

* thread #1, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS
(code=1, address=0x0)
  * frame #0: 0x0000000100bd81a9
jitter`llvm::orc::RTDyldObjectLinkingLayer::ConcreteLinkedObject<std::__1::shared_ptr<llvm::RuntimeDyld::MemoryManager>,
std::__1::shared_ptr<llvm::JITSymbolResolver>,
llvm::orc::RTDyldObjectLinkingLayer::addObject(std::__1::shared_ptr<llvm::object::OwningBinary<llvm::object::ObjectFile>
<span class="quote">>,</span >
std::__1::shared_ptr<llvm::JITSymbolResolver>)::'lambda'(std::__1::__list_iterator<std::__1::unique_ptr<llvm::orc::RTDyldObjectLinkingLayerBase::LinkedObject,
std::__1::default_delete<llvm::orc::RTDyldObjectLinkingLayerBase::LinkedObject>
<span class="quote">>, void*>, llvm::RuntimeDyld&,</span >
std::__1::shared_ptr<llvm::object::OwningBinary<llvm::object::ObjectFile> >
const&, std::__1::function<void
()>)>::buildInitialSymbolTable(std::__1::shared_ptr<llvm::object::OwningBinary<llvm::object::ObjectFile>
<span class="quote">> const&) + 41</span >
    frame #1: 0x0000000100bd8102
jitter`llvm::orc::RTDyldObjectLinkingLayer::addObject(std::__1::shared_ptr<llvm::object::OwningBinary<llvm::object::ObjectFile>
<span class="quote">>, std::__1::shared_ptr<llvm::JITSymbolResolver>) + 226</span >
    frame #2: 0x0000000100bd7b43 jitter`main + 963
    frame #3: 0x00007fff8ad77235 libdyld.dylib`start + 1</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>