Skip to content

Commit

Permalink
Revert "Round up zero-sized symbols to 1 byte in .debug_aranges."
Browse files Browse the repository at this point in the history
This reverts commit 256a52d (and
also the follow-up commit 38eb4fe that moved a test
case to a different directory).

As discussed in https://reviews.llvm.org/D126257 there is a suspicion
that something was wrong with this commit as text section range was
shortened to 1 byte rather than rounded up as shown in the
llvm/test/DebugInfo/X86/dwarf-aranges.ll test case.
  • Loading branch information
bjope committed May 31, 2022
1 parent f199b2b commit 86caa03
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 32 deletions.
10 changes: 3 additions & 7 deletions llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
Expand Up @@ -3042,17 +3042,13 @@ void DwarfDebug::emitDebugARanges() {
for (const ArangeSpan &Span : List) {
Asm->emitLabelReference(Span.Start, PtrSize);

// Calculate the size as being from the span start to its end.
//
// If the size is zero, then round it up to one byte. The DWARF
// specification requires that entries in this table have nonzero
// lengths.
uint64_t Size = SymSize[Span.Start];
if (Size != 0 && Span.End) {
// Calculate the size as being from the span start to it's end.
if (Span.End) {
Asm->emitLabelDifference(Span.End, Span.Start, PtrSize);
} else {
// For symbols without an end marker (e.g. common), we
// write a single arange entry containing just that one symbol.
uint64_t Size = SymSize[Span.Start];
if (Size == 0)
Size = 1;

Expand Down
23 changes: 0 additions & 23 deletions llvm/test/CodeGen/X86/dwarf-aranges-zero-size.ll

This file was deleted.

2 changes: 1 addition & 1 deletion llvm/test/DebugInfo/MSP430/dwarf-basics-v5.ll
Expand Up @@ -98,7 +98,7 @@

; CHECK: .debug_aranges contents:
; CHECK-NEXT: Address Range Header: length = 0x{{.*}}, format = DWARF32, version = 0x0002, cu_offset = 0x00000000, addr_size = 0x02, seg_size = 0x00
; CHECK-NEXT: [0x0000, 0x0001)
; CHECK-NEXT: [0x0000, 0x0006)

; CHECK: .debug_addr contents:
; CHECK-NEXT: Address table header: length = 0x{{.*}}, format = DWARF32, version = 0x0005, addr_size = 0x02, seg_size = 0x00
Expand Down
2 changes: 1 addition & 1 deletion llvm/test/DebugInfo/X86/dwarf-aranges.ll
Expand Up @@ -22,7 +22,7 @@

; <text section> - it should have made one span covering all functions in this CU.
; CHECK-NEXT: .quad .Lfunc_begin0
; CHECK-NEXT: .quad 1
; CHECK-NEXT: .quad .Lsec_end2-.Lfunc_begin0

; -- finish --
; CHECK-NEXT: # ARange terminator
Expand Down

0 comments on commit 86caa03

Please sign in to comment.