Skip to content

Commit d435acb

Browse files
authored
[DWARF] Don't emit DWARF5 symbols for DWARF2/3 + non-lldb (#110120)
Modify other legacy dwarf versions to align with the dwarf4 handling approach when determining whether to generate DWARF5 or GNU extensions.
1 parent e069434 commit d435acb

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed

llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1216,7 +1216,7 @@ void DwarfCompileUnit::constructAbstractSubprogramScopeDIE(
12161216
}
12171217

12181218
bool DwarfCompileUnit::useGNUAnalogForDwarf5Feature() const {
1219-
return DD->getDwarfVersion() == 4 && !DD->tuneForLLDB();
1219+
return DD->getDwarfVersion() <= 4 && !DD->tuneForLLDB();
12201220
}
12211221

12221222
dwarf::Tag DwarfCompileUnit::getDwarf5OrGNUTag(dwarf::Tag Tag) const {

llvm/test/DebugInfo/MIR/X86/call-site-gnu-vs-dwarf5-attrs.mir

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,21 @@
3030
# RUN: -debug-entry-values -mtriple=x86_64-unknown-unknown \
3131
# RUN: -start-after=machineverifier -o - %s | llvm-dwarfdump - | FileCheck %s -check-prefixes=CHECK-DWARF5
3232

33+
## === DWARF3, tune for gdb ===
34+
# RUN: llc -emit-call-site-info -dwarf-version 3 -debugger-tune=gdb -filetype=obj \
35+
# RUN: -mtriple=x86_64-unknown-unknown -start-after=machineverifier -o - %s \
36+
# RUN: | llvm-dwarfdump - | FileCheck %s -implicit-check-not=DW_AT_call
37+
38+
## === DWARF3, tune for lldb ===
39+
# RUN: llc -dwarf-version 3 -debugger-tune=lldb -emit-call-site-info -filetype=obj \
40+
# RUN: -mtriple=x86_64-unknown-unknown -start-after=machineverifier -o - %s \
41+
# RUN: | llvm-dwarfdump - | FileCheck %s -implicit-check-not=DW_AT_GNU_call
42+
43+
## === DWARF3, tune for sce ===
44+
# RUN: llc -emit-call-site-info -dwarf-version 3 -filetype=obj -debugger-tune=sce \
45+
# RUN: -debug-entry-values -mtriple=x86_64-unknown-unknown \
46+
# RUN: -start-after=machineverifier -o - %s | llvm-dwarfdump - | FileCheck %s -implicit-check-not=DW_AT_call
47+
3348
## This is based on the following reproducer:
3449
##
3550
## extern void fn();

0 commit comments

Comments
 (0)