diff options
author | Alexey Bataev <a.bataev@hotmail.com> | 2019-03-08 20:08:04 +0000 |
---|---|---|
committer | Alexey Bataev <a.bataev@hotmail.com> | 2019-03-08 20:08:04 +0000 |
commit | 78fcb8381fea0c754bdb23c107dce536fd0b2437 (patch) | |
tree | a9bd0321455f8d6936c6adbdd31b2db8c0db7907 | |
parent | 57b38a8593bd7d63b9db09676087365d8d3d0d8a (diff) | |
download | bcm5719-llvm-78fcb8381fea0c754bdb23c107dce536fd0b2437.tar.gz bcm5719-llvm-78fcb8381fea0c754bdb23c107dce536fd0b2437.zip |
[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
llvm-svn: 355719
-rw-r--r-- | llvm/lib/Target/NVPTX/NVPTXAsmPrinter.cpp | 5 | ||||
-rw-r--r-- | llvm/test/DebugInfo/NVPTX/debug-empty.ll | 1 |
2 files changed, 5 insertions, 1 deletions
diff --git a/llvm/lib/Target/NVPTX/NVPTXAsmPrinter.cpp b/llvm/lib/Target/NVPTX/NVPTXAsmPrinter.cpp index 274f1c59b6c..5c840e5cc7c 100644 --- a/llvm/lib/Target/NVPTX/NVPTXAsmPrinter.cpp +++ b/llvm/lib/Target/NVPTX/NVPTXAsmPrinter.cpp @@ -954,9 +954,12 @@ bool NVPTXAsmPrinter::doFinalization(Module &M) { 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()) diff --git a/llvm/test/DebugInfo/NVPTX/debug-empty.ll b/llvm/test/DebugInfo/NVPTX/debug-empty.ll index f1ebf739d2f..cae258815e4 100644 --- a/llvm/test/DebugInfo/NVPTX/debug-empty.ll +++ b/llvm/test/DebugInfo/NVPTX/debug-empty.ll @@ -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} |