]> granicus.if.org Git - llvm/commitdiff
Check that line table entries don't spill over between sections even if they're empty...
authorDavid Blaikie <dblaikie@gmail.com>
Thu, 16 Mar 2017 00:52:18 +0000 (00:52 +0000)
committerDavid Blaikie <dblaikie@gmail.com>
Thu, 16 Mar 2017 00:52:18 +0000 (00:52 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@297922 91177308-0d34-0410-b5e6-96231b3b80d8

lib/MC/MCObjectStreamer.cpp
test/MC/X86/line-table-sections.s [new file with mode: 0644]

index 2b89407547a47cd65b30128badc71e70298b2ac0..8f502fc3e2f884bd30477995877c6a2ea3094074 100644 (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);
 
diff --git a/test/MC/X86/line-table-sections.s b/test/MC/X86/line-table-sections.s
new file mode 100644 (file)
index 0000000..93b911d
--- /dev/null
@@ -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
+