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

David Blaikie via llvm-commits llvm-commits at lists.llvm.org
Wed Mar 15 17:52:18 PDT 2017


Author: dblaikie
Date: Wed Mar 15 19:52:18 2017
New Revision: 297922

URL: http://llvm.org/viewvc/llvm-project?rev=297922&view=rev
Log:
Check that line table entries don't spill over between sections even if they're empty at the end of a section

Added:
    llvm/trunk/test/MC/X86/line-table-sections.s
Modified:
    llvm/trunk/lib/MC/MCObjectStreamer.cpp

Modified: llvm/trunk/lib/MC/MCObjectStreamer.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCObjectStreamer.cpp?rev=297922&r1=297921&r2=297922&view=diff
==============================================================================
--- llvm/trunk/lib/MC/MCObjectStreamer.cpp (original)
+++ llvm/trunk/lib/MC/MCObjectStreamer.cpp Wed Mar 15 19:52:18 2017
@@ -203,6 +203,7 @@ bool MCObjectStreamer::changeSectionImpl
                                          const MCExpr *Subsection) {
   assert(Section && "Cannot switch to a null section!");
   flushPendingLabels(nullptr);
+  getContext().clearDwarfLocSeen();
 
   bool Created = getAssembler().registerSection(*Section);
 

Added: llvm/trunk/test/MC/X86/line-table-sections.s
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/X86/line-table-sections.s?rev=297922&view=auto
==============================================================================
--- llvm/trunk/test/MC/X86/line-table-sections.s (added)
+++ llvm/trunk/test/MC/X86/line-table-sections.s Wed Mar 15 19:52:18 2017
@@ -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,"", at progbits
+	.long	46                      # Length of Unit
+




More information about the llvm-commits mailing list