From: David Blaikie Date: Thu, 16 Mar 2017 00:52:18 +0000 (+0000) Subject: Check that line table entries don't spill over between sections even if they're empty... X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=bd97f5e153f21fd9fbb9e7d0501c34d7516ec569;p=llvm Check that line table entries don't spill over between sections even if they're empty at the end of a section git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@297922 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/MC/MCObjectStreamer.cpp b/lib/MC/MCObjectStreamer.cpp index 2b89407547a..8f502fc3e2f 100644 --- a/lib/MC/MCObjectStreamer.cpp +++ b/lib/MC/MCObjectStreamer.cpp @@ -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); diff --git a/test/MC/X86/line-table-sections.s b/test/MC/X86/line-table-sections.s new file mode 100644 index 00000000000..93b911d9576 --- /dev/null +++ b/test/MC/X86/line-table-sections.s @@ -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 +