<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 --- - MachObjectWriter::WriteNlist() might be grabbing the wrong symbol offset, or may otherwise be wrong" href="https://urldefense.proofpoint.com/v2/url?u=https-3A__llvm.org_bugs_show-5Fbug.cgi-3Fid-3D23598&d=AwMBaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=pF93YEPyB-J_PERP4DUZOJDzFVX5ZQ57vQk33wu0vio&m=dn8gsath5fdnr_5BPw-lFbpDCBpNXZ7LZSr2Qs1X8nE&s=u8-eI9Ork8SV1fmTEITjCNxi54cbm5B16w-9uTnW10s&e=">23598</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>MachObjectWriter::WriteNlist() might be grabbing the wrong symbol offset, or may otherwise be wrong
          </td>
        </tr>

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

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

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

        <tr>
          <th>OS</th>
          <td>All
          </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>MC
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>dexonsmith@apple.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>enderby@apple.com, kledzik@apple.com, lhames@gmail.com, llvmbugs@cs.uiuc.edu
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>I added a FIXME in r237750 when I noticed strange mixing of an `MCSymbol
*Symbol` and an `MCSymbolData &Data`, which aren't necessarily talking about
the same "symbol".

@@ -377,7 +373,9 @@ void MachObjectWriter::WriteNlist(MachSymbolData &MSD,
   if (IsAlias && Symbol->isUndefined())
     Address = AliaseeInfo->StringIndex;
   else if (Symbol->isDefined())
-    Address = getSymbolAddress(&Data, Layout);
+    // FIXME: Should Data.getSymbol() always be *Symbol?  It doesn't look like
+    // that's true.
+    Address = getSymbolAddress(Data.getSymbol(), Layout);
   else if (Data.isCommon()) {
     // Common symbols are encoded with the size in the address
     // field, and their alignment in the flags.

I'll circle back to this eventually -- the whole function looks kind of hairy
-- but anyone else feel free to look into it in the meantime.

I'm about to move the FIXME around, since I'm removing the MCSymbolData
backpointer to MCSymbol, but the code won't really change.  I'll reference the
PR in the commit.</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>