[llvm] r247814 - Add assembler fatal error for undefined assembler labels in COFF writer

Reid Kleckner via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 16 09:26:29 PDT 2015


Author: rnk
Date: Wed Sep 16 11:26:29 2015
New Revision: 247814

URL: http://llvm.org/viewvc/llvm-project?rev=247814&view=rev
Log:
Add assembler fatal error for undefined assembler labels in COFF writer

Added:
    llvm/trunk/test/MC/COFF/label-undefined.s
Modified:
    llvm/trunk/lib/MC/WinCOFFObjectWriter.cpp

Modified: llvm/trunk/lib/MC/WinCOFFObjectWriter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/WinCOFFObjectWriter.cpp?rev=247814&r1=247813&r2=247814&view=diff
==============================================================================
--- llvm/trunk/lib/MC/WinCOFFObjectWriter.cpp (original)
+++ llvm/trunk/lib/MC/WinCOFFObjectWriter.cpp Wed Sep 16 11:26:29 2015
@@ -710,6 +710,11 @@ void WinCOFFObjectWriter::recordRelocati
     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();
 

Added: llvm/trunk/test/MC/COFF/label-undefined.s
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/COFF/label-undefined.s?rev=247814&view=auto
==============================================================================
--- llvm/trunk/test/MC/COFF/label-undefined.s (added)
+++ llvm/trunk/test/MC/COFF/label-undefined.s Wed Sep 16 11:26:29 2015
@@ -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




More information about the llvm-commits mailing list