summaryrefslogtreecommitdiffstats
path: root/llvm/lib/MC/MachObjectWriter.cpp
diff options
context:
space:
mode:
authorDaniel Dunbar <daniel@zuster.org>2010-05-11 23:53:05 +0000
committerDaniel Dunbar <daniel@zuster.org>2010-05-11 23:53:05 +0000
commit795baa19720edf3bf3515280751f5ec07f1fe805 (patch)
treea32f0805b56824d58d12bb814e64551ac72fb5e5 /llvm/lib/MC/MachObjectWriter.cpp
parentdeb23ecdf93ba373747f2ec91f28672758d40ae1 (diff)
downloadbcm5719-llvm-795baa19720edf3bf3515280751f5ec07f1fe805.tar.gz
bcm5719-llvm-795baa19720edf3bf3515280751f5ec07f1fe805.zip
MC/Mach-O: Fix a crash on invalid.
llvm-svn: 103525
Diffstat (limited to 'llvm/lib/MC/MachObjectWriter.cpp')
-rw-r--r--llvm/lib/MC/MachObjectWriter.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/llvm/lib/MC/MachObjectWriter.cpp b/llvm/lib/MC/MachObjectWriter.cpp
index c45fbd5dad0..0b005838c6a 100644
--- a/llvm/lib/MC/MachObjectWriter.cpp
+++ b/llvm/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();
OpenPOWER on IntegriCloud