[llvm] r200490 - Fix PR18381 - print a minimal diagnostic rather than assert on unresolved .secidx target
Timur Iskhodzhanov
timurrrr at google.com
Thu Jan 30 13:13:06 PST 2014
Author: timurrrr
Date: Thu Jan 30 15:13:05 2014
New Revision: 200490
URL: http://llvm.org/viewvc/llvm-project?rev=200490&view=rev
Log:
Fix PR18381 - print a minimal diagnostic rather than assert on unresolved .secidx target
Added:
llvm/trunk/test/MC/COFF/secidx-diagnostic.s
Modified:
llvm/trunk/include/llvm/MC/MCAssembler.h
llvm/trunk/lib/MC/WinCOFFObjectWriter.cpp
Modified: llvm/trunk/include/llvm/MC/MCAssembler.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/MC/MCAssembler.h?rev=200490&r1=200489&r2=200490&view=diff
==============================================================================
--- llvm/trunk/include/llvm/MC/MCAssembler.h (original)
+++ llvm/trunk/include/llvm/MC/MCAssembler.h Thu Jan 30 15:13:05 2014
@@ -1153,6 +1153,10 @@ public:
return *Entry;
}
+ bool hasSymbolData(const MCSymbol &Symbol) const {
+ return SymbolMap.lookup(&Symbol) != 0;
+ }
+
MCSymbolData &getSymbolData(const MCSymbol &Symbol) const {
MCSymbolData *Entry = SymbolMap.lookup(&Symbol);
assert(Entry && "Missing symbol data!");
Modified: llvm/trunk/lib/MC/WinCOFFObjectWriter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/WinCOFFObjectWriter.cpp?rev=200490&r1=200489&r2=200490&view=diff
==============================================================================
--- llvm/trunk/lib/MC/WinCOFFObjectWriter.cpp (original)
+++ llvm/trunk/lib/MC/WinCOFFObjectWriter.cpp Thu Jan 30 15:13:05 2014
@@ -636,6 +636,11 @@ void WinCOFFObjectWriter::RecordRelocati
const MCSymbol &Symbol = Target.getSymA()->getSymbol();
const MCSymbol &A = Symbol.AliasedSymbol();
+ if (!Asm.hasSymbolData(A))
+ Asm.getContext().FatalError(
+ Fixup.getLoc(),
+ Twine("symbol '") + A.getName() + "' can not be undefined");
+
MCSymbolData &A_SD = Asm.getSymbolData(A);
MCSectionData const *SectionData = Fragment->getParent();
Added: llvm/trunk/test/MC/COFF/secidx-diagnostic.s
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/COFF/secidx-diagnostic.s?rev=200490&view=auto
==============================================================================
--- llvm/trunk/test/MC/COFF/secidx-diagnostic.s (added)
+++ llvm/trunk/test/MC/COFF/secidx-diagnostic.s Thu Jan 30 15:13:05 2014
@@ -0,0 +1,8 @@
+// RUN: not llvm-mc -filetype=obj -triple i686-pc-win32 %s 2>%t
+// RUN: FileCheck %s < %t
+
+// CHECK: symbol 'bar' can not be undefined
+
+.data
+foo:
+ .secidx bar
More information about the llvm-commits
mailing list