MC/Mach-O: Fix a crash on invalid.

llvm-svn: 103525
This commit is contained in:
Daniel Dunbar 2010-05-11 23:53:05 +00:00
parent 6768d483a0
commit e43676c164

View File

@ -584,7 +584,7 @@ public:
// Add the local offset, if needed.
if (Base != &SD)
Value += Layout.getSymbolAddress(&SD) - Layout.getSymbolAddress(Base);
} else {
} else if (Symbol->isInSection()) {
// The index is the section ordinal (1-based).
Index = SD.getFragment()->getParent()->getOrdinal() + 1;
IsExtern = 0;
@ -592,6 +592,9 @@ public:
if (IsPCRel)
Value -= Address + (1 << Log2Size);
} else {
report_fatal_error("unsupported relocation of undefined symbol '" +
Symbol->getName() + "'");
}
MCSymbolRefExpr::VariantKind Modifier = Target.getSymA()->getKind();