From cba458eecc0e3d6d44c7ac07758b79bf18be8f0e Mon Sep 17 00:00:00 2001 From: Reid Kleckner Date: Wed, 16 Sep 2015 16:26:29 +0000 Subject: [PATCH] Add assembler fatal error for undefined assembler labels in COFF writer git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@247814 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/MC/WinCOFFObjectWriter.cpp | 5 +++++ test/MC/COFF/label-undefined.s | 4 ++++ 2 files changed, 9 insertions(+) create mode 100644 test/MC/COFF/label-undefined.s diff --git a/lib/MC/WinCOFFObjectWriter.cpp b/lib/MC/WinCOFFObjectWriter.cpp index 6c696738b48..f251942161d 100644 --- a/lib/MC/WinCOFFObjectWriter.cpp +++ b/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/test/MC/COFF/label-undefined.s b/test/MC/COFF/label-undefined.s new file mode 100644 index 00000000000..e5cfd3ca5a3 --- /dev/null +++ b/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 -- 2.34.1