Skip to content

Commit c393da3

Browse files
playstation-eddyuxuanchen1997
authored andcommitted
Omit .debug_aranges if it is empty (#99897)
Summary: SIE tracker: https://jira.sie.sony.com/browse/TOOLCHAIN-16575 Test Plan: Reviewers: Subscribers: Tasks: Tags: Differential Revision: https://phabricator.intern.facebook.com/D60251220
1 parent 8f30c92 commit c393da3

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2990,6 +2990,9 @@ struct ArangeSpan {
29902990
// Emit a debug aranges section, containing a CU lookup for any
29912991
// address we can tie back to a CU.
29922992
void DwarfDebug::emitDebugARanges() {
2993+
if (ArangeLabels.empty())
2994+
return;
2995+
29932996
// Provides a unique id per text section.
29942997
MapVector<MCSection *, SmallVector<SymbolCU, 8>> SectionMap;
29952998

@@ -3012,8 +3015,7 @@ void DwarfDebug::emitDebugARanges() {
30123015
for (auto &I : SectionMap) {
30133016
MCSection *Section = I.first;
30143017
SmallVector<SymbolCU, 8> &List = I.second;
3015-
if (List.size() < 1)
3016-
continue;
3018+
assert(!List.empty());
30173019

30183020
// If we have no section (e.g. common), just write out
30193021
// individual spans for each symbol.

llvm/test/DebugInfo/omit-empty.ll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
; RUN: %llc_dwarf %s -filetype=obj -o - | llvm-objdump -h - | FileCheck %s
1+
; RUN: %llc_dwarf %s -filetype=obj -generate-arange-section -o - | llvm-objdump -h - | FileCheck %s
22
; REQUIRES: object-emission
33

44
; CHECK-NOT: .debug_

0 commit comments

Comments
 (0)