diff options
author | Daniel Dunbar <daniel@zuster.org> | 2010-05-11 23:53:05 +0000 |
---|---|---|
committer | Daniel Dunbar <daniel@zuster.org> | 2010-05-11 23:53:05 +0000 |
commit | ef4591ef7970d6da77eaf20fddbb522e99dc7615 (patch) | |
tree | 05cccdba79171115d19050611354b08e75c3b1a6 | |
parent | 6865f29fe71559a18d7f2ff0bc4f67c5fc1d000e (diff) |
MC/Mach-O: Fix a crash on invalid.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@103525 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | lib/MC/MachObjectWriter.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/MC/MachObjectWriter.cpp b/lib/MC/MachObjectWriter.cpp index c45fbd5dad..0b005838c6 100644 --- a/lib/MC/MachObjectWriter.cpp +++ b/lib/MC/MachObjectWriter.cpp @@ -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(); |