[PATCH] Fix PR18381 - print a minimal diagnostic rather than assert on unresolved .secidx target
Timur Iskhodzhanov
timurrrr at google.com
Thu Jan 30 12:21:56 PST 2014
Hi echristo, rnk, grosbach,
http://llvm-reviews.chandlerc.com/D2653
CHANGE SINCE LAST DIFF
http://llvm-reviews.chandlerc.com/D2653?vs=6760&id=6779#toc
Files:
include/llvm/MC/MCAssembler.h
lib/MC/WinCOFFObjectWriter.cpp
test/MC/COFF/secidx_diagnostic.s
Index: include/llvm/MC/MCAssembler.h
===================================================================
--- include/llvm/MC/MCAssembler.h
+++ include/llvm/MC/MCAssembler.h
@@ -1153,6 +1153,10 @@
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!");
Index: lib/MC/WinCOFFObjectWriter.cpp
===================================================================
--- lib/MC/WinCOFFObjectWriter.cpp
+++ lib/MC/WinCOFFObjectWriter.cpp
@@ -636,6 +636,11 @@
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();
Index: test/MC/COFF/secidx_diagnostic.s
===================================================================
--- test/MC/COFF/secidx_diagnostic.s
+++ test/MC/COFF/secidx_diagnostic.s
@@ -1,8 +1,8 @@
// RUN: not llvm-mc -filetype=obj -triple i686-pc-win32 %s 2>%t
// RUN: FileCheck %s < %t
-// CHECK: Can't resolve the 'bar at 2' symbol
+// CHECK: symbol 'bar' can not be undefined
.data
foo:
- .secidx bar at 2
+ .secidx bar
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D2653.2.patch
Type: text/x-patch
Size: 1506 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20140130/c7758c79/attachment.bin>
More information about the llvm-commits
mailing list