[MC] Issue error message when data region is not terminated

llvm-svn: 324868
This commit is contained in:
Gerolf Hoflehner 2018-02-12 07:19:05 +00:00
parent b57ca09e43
commit bf82e99691
2 changed files with 15 additions and 1 deletions

View File

@ -945,7 +945,13 @@ void MachObjectWriter::writeObject(MCAssembler &Asm,
it != ie; ++it) {
const DataRegionData *Data = &(*it);
uint64_t Start = getSymbolAddress(*Data->Start, Layout);
uint64_t End = getSymbolAddress(*Data->End, Layout);
uint64_t End;
if (Data->End)
End = getSymbolAddress(*Data->End, Layout);
else
report_fatal_error("Data region not terminated");
DEBUG(dbgs() << "data in code region-- kind: " << Data->Kind
<< " start: " << Start << "(" << Data->Start->getName() << ")"
<< " end: " << End << "(" << Data->End->getName() << ")"

View File

@ -0,0 +1,8 @@
// RUN: not llvm-mc -triple=x86_64-apple-darwin -filetype=obj -o /dev/null %s 2>&1 | FileCheck %s --check-prefix=CHECK-ERROR
.align 4
.data_region jt32
foo:
.long 0
// CHECK-ERROR: LLVM ERROR: Data region not terminated