diff options
| -rw-r--r-- | llvm/lib/MC/WinCOFFObjectWriter.cpp | 5 | ||||
| -rw-r--r-- | llvm/test/MC/COFF/label-undefined.s | 4 |
2 files changed, 9 insertions, 0 deletions
diff --git a/llvm/lib/MC/WinCOFFObjectWriter.cpp b/llvm/lib/MC/WinCOFFObjectWriter.cpp index 6c696738b48..f251942161d 100644 --- a/llvm/lib/MC/WinCOFFObjectWriter.cpp +++ b/llvm/lib/MC/WinCOFFObjectWriter.cpp @@ -710,6 +710,11 @@ void WinCOFFObjectWriter::recordRelocation( Asm.getContext().reportFatalError(Fixup.getLoc(), Twine("symbol '") + A.getName() + "' can not be undefined"); + if (A.isTemporary() && A.isUndefined()) { + Asm.getContext().reportFatalError(Fixup.getLoc(), + Twine("assembler label '") + A.getName() + + "' can not be undefined"); + } MCSection *Section = Fragment->getParent(); diff --git a/llvm/test/MC/COFF/label-undefined.s b/llvm/test/MC/COFF/label-undefined.s new file mode 100644 index 00000000000..e5cfd3ca5a3 --- /dev/null +++ b/llvm/test/MC/COFF/label-undefined.s @@ -0,0 +1,4 @@ +// RUN: not llvm-mc -filetype=obj -triple i386-pc-win32 %s 2>&1 | FileCheck %s +// CHECK: assembler label 'Lundefined' can not be undefined + .text + movl Lundefined, %eax |

