[llvm] [DWARF] Do not emit DWARF5 symbols in the case of DWARF2/3 + non-lldb (PR #110120)
via llvm-commits
llvm-commits at lists.llvm.org
Thu Sep 26 06:09:24 PDT 2024
https://github.com/linsinan1995 created https://github.com/llvm/llvm-project/pull/110120
Modify other legacy dwarf versions to align with the dwarf4 handling approach when determining whether to generate DWARF5 or GNU extensions.
>From 16b422b3b78b5e8c97c9cffe79615140beb6b230 Mon Sep 17 00:00:00 2001
From: Sinan Lin <sinan.lin at linux.alibaba.com>
Date: Thu, 26 Sep 2024 20:36:21 +0800
Subject: [PATCH] [DWARF] Do not emit DWARF5 symbols in the case of DWARF2/3 +
non-lldb
Modify other legacy dwarf versions to align with the dwarf4 handling
approach when determining whether to generate DWARF5 or GNU extensions.
---
llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp | 2 +-
.../MIR/X86/call-site-gnu-vs-dwarf5-attrs.mir | 15 +++++++++++++++
2 files changed, 16 insertions(+), 1 deletion(-)
diff --git a/llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp b/llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp
index 0a1ff189bedbc4..ad7fdb12e9ccb6 100644
--- a/llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp
+++ b/llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp
@@ -1209,7 +1209,7 @@ void DwarfCompileUnit::constructAbstractSubprogramScopeDIE(
}
bool DwarfCompileUnit::useGNUAnalogForDwarf5Feature() const {
- return DD->getDwarfVersion() == 4 && !DD->tuneForLLDB();
+ return DD->getDwarfVersion() <= 4 && !DD->tuneForLLDB();
}
dwarf::Tag DwarfCompileUnit::getDwarf5OrGNUTag(dwarf::Tag Tag) const {
diff --git a/llvm/test/DebugInfo/MIR/X86/call-site-gnu-vs-dwarf5-attrs.mir b/llvm/test/DebugInfo/MIR/X86/call-site-gnu-vs-dwarf5-attrs.mir
index 1790f761585c35..a9c20d774822ec 100644
--- a/llvm/test/DebugInfo/MIR/X86/call-site-gnu-vs-dwarf5-attrs.mir
+++ b/llvm/test/DebugInfo/MIR/X86/call-site-gnu-vs-dwarf5-attrs.mir
@@ -30,6 +30,21 @@
# RUN: -debug-entry-values -mtriple=x86_64-unknown-unknown \
# RUN: -start-after=machineverifier -o - %s | llvm-dwarfdump - | FileCheck %s -check-prefixes=CHECK-DWARF5
+## === DWARF3, tune for gdb ===
+# RUN: llc -emit-call-site-info -dwarf-version 3 -debugger-tune=gdb -filetype=obj \
+# RUN: -mtriple=x86_64-unknown-unknown -start-after=machineverifier -o - %s \
+# RUN: | llvm-dwarfdump - | FileCheck %s -implicit-check-not=DW_AT_call
+
+## === DWARF3, tune for lldb ===
+# RUN: llc -dwarf-version 3 -debugger-tune=lldb -emit-call-site-info -filetype=obj \
+# RUN: -mtriple=x86_64-unknown-unknown -start-after=machineverifier -o - %s \
+# RUN: | llvm-dwarfdump - | FileCheck %s -implicit-check-not=DW_AT_GNU_call
+
+## === DWARF3, tune for sce ===
+# RUN: llc -emit-call-site-info -dwarf-version 3 -filetype=obj -debugger-tune=sce \
+# RUN: -debug-entry-values -mtriple=x86_64-unknown-unknown \
+# RUN: -start-after=machineverifier -o - %s | llvm-dwarfdump - | FileCheck %s -implicit-check-not=DW_AT_call
+
## This is based on the following reproducer:
##
## extern void fn();
More information about the llvm-commits
mailing list