[llvm] r355719 - [DEBUG_INFO][NVPTX]Emit empty .debug_loc section in presence of the debug option.
Alexey Bataev via llvm-commits
llvm-commits at lists.llvm.org
Fri Mar 8 12:08:04 PST 2019
Author: abataev
Date: Fri Mar 8 12:08:04 2019
New Revision: 355719
URL: http://llvm.org/viewvc/llvm-project?rev=355719&view=rev
Log:
[DEBUG_INFO][NVPTX]Emit empty .debug_loc section in presence of the debug option.
Summary:
If the LLVM module shows that it has debug info, but the file is
actually empty and the real debug info is not emitted, the ptxas tool
emits error 'Debug information not found in presence of .target debug'.
We need at leas one empty debug section to silence this message. Section
`.debug_loc` is not emitted for PTX and we can emit empty `.debug_loc`
section if `debug` option was emitted.
Reviewers: tra
Subscribers: jholewinski, aprantl, llvm-commits
Differential Revision: https://reviews.llvm.org/D57250
Modified:
llvm/trunk/lib/Target/NVPTX/NVPTXAsmPrinter.cpp
llvm/trunk/test/DebugInfo/NVPTX/debug-empty.ll
Modified: llvm/trunk/lib/Target/NVPTX/NVPTXAsmPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/NVPTX/NVPTXAsmPrinter.cpp?rev=355719&r1=355718&r2=355719&view=diff
==============================================================================
--- llvm/trunk/lib/Target/NVPTX/NVPTXAsmPrinter.cpp (original)
+++ llvm/trunk/lib/Target/NVPTX/NVPTXAsmPrinter.cpp Fri Mar 8 12:08:04 2019
@@ -954,9 +954,12 @@ bool NVPTXAsmPrinter::doFinalization(Mod
delete[] gv_array;
// Close the last emitted section
- if (HasDebugInfo)
+ if (HasDebugInfo) {
static_cast<NVPTXTargetStreamer *>(OutStreamer->getTargetStreamer())
->closeLastSection();
+ // Emit empty .debug_loc section for better support of the empty files.
+ OutStreamer->EmitRawText("\t.section\t.debug_loc\t{\t}");
+ }
// Output last DWARF .file directives, if any.
static_cast<NVPTXTargetStreamer *>(OutStreamer->getTargetStreamer())
Modified: llvm/trunk/test/DebugInfo/NVPTX/debug-empty.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/NVPTX/debug-empty.ll?rev=355719&r1=355718&r2=355719&view=diff
==============================================================================
--- llvm/trunk/test/DebugInfo/NVPTX/debug-empty.ll (original)
+++ llvm/trunk/test/DebugInfo/NVPTX/debug-empty.ll Fri Mar 8 12:08:04 2019
@@ -1,6 +1,7 @@
; RUN: llc < %s -mtriple=nvptx64-nvidia-cuda | FileCheck %s
; CHECK: .target sm_{{[0-9]+$}}
+; CHECK: .section .debug_loc { }
; CHECK-NOT: }
!llvm.dbg.cu = !{!0}
More information about the llvm-commits
mailing list