[llvm] r237867 - MC: Remove last use of MCSymbolData::getSymbol(), NFC
Duncan P. N. Exon Smith
dexonsmith at apple.com
Wed May 20 17:39:24 PDT 2015
Author: dexonsmith
Date: Wed May 20 19:39:24 2015
New Revision: 237867
URL: http://llvm.org/viewvc/llvm-project?rev=237867&view=rev
Log:
MC: Remove last use of MCSymbolData::getSymbol(), NFC
Remove the last use of `MCSymbolData::getSymbol()`. There's some
*really* hairy stuff going on in `MachObjectWriter::WriteNList()` that I
want to come back to. In particular, it updates `Symbol` to point at
its aliasee (if any), but leaves `Data` behind, and it's not clear
whether everything makes sense there.
For now I've left the logic unchanged by adding `OrigSymbol` and moving
the FIXME from r237750 up a bit higher. I've filed PR23598 to track
looking into this.
Modified:
llvm/trunk/lib/MC/MachObjectWriter.cpp
Modified: llvm/trunk/lib/MC/MachObjectWriter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MachObjectWriter.cpp?rev=237867&r1=237866&r2=237867&view=diff
==============================================================================
--- llvm/trunk/lib/MC/MachObjectWriter.cpp (original)
+++ llvm/trunk/lib/MC/MachObjectWriter.cpp Wed May 20 19:39:24 2015
@@ -338,12 +338,14 @@ void MachObjectWriter::WriteNlist(MachSy
uint64_t Address = 0;
bool IsAlias = Symbol != AliasedSymbol;
+ const MCSymbol &OrigSymbol = *Symbol;
MachSymbolData *AliaseeInfo;
if (IsAlias) {
AliaseeInfo = findSymbolData(*AliasedSymbol);
if (AliaseeInfo)
SectionIndex = AliaseeInfo->SectionIndex;
Symbol = AliasedSymbol;
+ // FIXME: Should this update Data as well? Do we need OrigSymbol at all?
}
// Set the N_TYPE bits. See <mach-o/nlist.h>.
@@ -371,9 +373,7 @@ void MachObjectWriter::WriteNlist(MachSy
if (IsAlias && Symbol->isUndefined())
Address = AliaseeInfo->StringIndex;
else if (Symbol->isDefined())
- // FIXME: Should Data.getSymbol() always be *Symbol? It doesn't look like
- // that's true.
- Address = getSymbolAddress(Data.getSymbol(), Layout);
+ Address = getSymbolAddress(OrigSymbol, Layout);
else if (Data.isCommon()) {
// Common symbols are encoded with the size in the address
// field, and their alignment in the flags.
More information about the llvm-commits
mailing list