Check that line table entries don't spill over between sections even if they're empty at the end of a section

llvm-svn: 297922
This commit is contained in:
David Blaikie 2017-03-16 00:52:18 +00:00
parent 618d3429f2
commit 6c5bbae7b3
2 changed files with 16 additions and 0 deletions

View File

@ -203,6 +203,7 @@ bool MCObjectStreamer::changeSectionImpl(MCSection *Section,
const MCExpr *Subsection) {
assert(Section && "Cannot switch to a null section!");
flushPendingLabels(nullptr);
getContext().clearDwarfLocSeen();
bool Created = getAssembler().registerSection(*Section);

View File

@ -0,0 +1,15 @@
// RUN: llvm-mc -triple x86_64-unknown-unknown -filetype=obj %s | llvm-objdump -r - | FileCheck %s
// CHECK-NOT: RELOCATION RECORDS
// ensure that a .loc directive at the end of a section doesn't bleed into the
// following section previously this would produce a relocation for
// .other_section in the line table. But it should actually produce no line
// table entries at all.
.text
.file 1 "fail.cpp"
.loc 1 7 3 prologue_end # fail.cpp:7:3
# addss %xmm0, %xmm1
.section .other_section,"",@progbits
.long 46 # Length of Unit