https://llvm.org/bugs/show_bug.cgi?id=23598

            Bug ID: 23598
           Summary: MachObjectWriter::WriteNlist() might be grabbing the
                    wrong symbol offset, or may otherwise be wrong
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: MC
          Assignee: [email protected]
          Reporter: [email protected]
                CC: [email protected], [email protected],
                    [email protected], [email protected]
    Classification: Unclassified

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.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
LLVMbugs mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs

Reply via email to