<html>
    <head>
      <base href="https://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 --- - RTDyldMemoryManager::getSymbolAddressInProcess not working on Windows"
   href="https://llvm.org/bugs/show_bug.cgi?id=28699">28699</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>RTDyldMemoryManager::getSymbolAddressInProcess not working on Windows
          </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>Windows NT
          </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>j4_james@hotmail.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Originally the RTDyldMemoryManager::getSymbolAddressInProcess method included
code that demangled the symbol name (i.e. removed the underscore prefix) on all
platforms, but that behaviour was changed in revision 262657 so it's now only
applied on the __APPLE__ platform. This change seems to have caused the method
to fail on Windows.

For example, when testing the BrainF example app, I was able to get a sample
helloworld script to compile to bitcode, but when I tried to execute that
bitcode with the lli interpreter, it produced the error:

LLVM ERROR: Program used external function '_free' which could not be resolved!

Once I updated the code that strips the underscore so that it was applied on
both the __APPLE__ and _WIN32 platforms, the interpreter was then able to
execute the bitcode successfully.

That said, I'm not sure that's necessarily the correct solution. Is it possible
there may be cases where the name genuinely does need to be left with the
underscore intact on Windows? The original code tried to lookup the name both
with and without the prefix, which may be the safer option.

In case it makes any difference, I'm testing with Visual Studio 2015 Community
Edition on Windows 10 and the LLVM suite was built from trunk (currently
revision 276679) with cmake -G "Visual Studio 14 2015"</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>