Skip to content

Commit 0a2d415

Browse files
committed
[LLD] Report errors occurred while parsing debug info as warnings.
Summary: Extracted from D74773. Currently, errors happened while parsing debug info are reported as errors. DebugInfoDWARF library treats such errors as "Recoverable errors". This patch makes debug info errors to be reported as warnings, to support DebugInfoDWARF approach. Reviewers: ruiu, grimar, MaskRay, jhenderson, espindola Reviewed By: MaskRay, jhenderson Subscribers: emaste, aprantl, arichardson, arphaman, llvm-commits Tags: #llvm, #debug-info, #lld Differential Revision: https://reviews.llvm.org/D75234
1 parent e551b73 commit 0a2d415

File tree

3 files changed

+8
-8
lines changed

3 files changed

+8
-8
lines changed

lld/ELF/SyntheticSections.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2668,12 +2668,12 @@ readAddressAreas(DWARFContext &dwarf, InputSection *sec) {
26682668
uint32_t cuIdx = 0;
26692669
for (std::unique_ptr<DWARFUnit> &cu : dwarf.compile_units()) {
26702670
if (Error e = cu->tryExtractDIEsIfNeeded(false)) {
2671-
error(toString(sec) + ": " + toString(std::move(e)));
2671+
warn(toString(sec) + ": " + toString(std::move(e)));
26722672
return {};
26732673
}
26742674
Expected<DWARFAddressRangesVector> ranges = cu->collectAddressRanges();
26752675
if (!ranges) {
2676-
error(toString(sec) + ": " + toString(ranges.takeError()));
2676+
warn(toString(sec) + ": " + toString(ranges.takeError()));
26772677
return {};
26782678
}
26792679

lld/test/ELF/gdb-index-invalid-ranges.s

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
# REQUIRES: x86
22
# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t.o
3-
# RUN: not ld.lld --gdb-index -e main %t.o -o /dev/null 2>&1 | FileCheck %s
3+
# RUN: ld.lld --gdb-index -e main %t.o -o /dev/null 2>&1 | FileCheck %s
44
# RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %p/Inputs/gdb-index-invalid-ranges.obj.s -o %t2.o
55
# RUN: llvm-ar rc %t.a %t.o
6-
# RUN: not ld.lld --gdb-index -e main %t2.o %t.a -o /dev/null 2>&1 | FileCheck --check-prefix=ARCHIVE %s
6+
# RUN: ld.lld --gdb-index -e main %t2.o %t.a -o /dev/null 2>&1 | FileCheck --check-prefix=ARCHIVE %s
77

8-
# CHECK: ld.lld: error: {{.*}}gdb-index-invalid-ranges.s.tmp.o:(.debug_info): decoding address ranges: invalid range list entry at offset 0x10
9-
# ARCHIVE: ld.lld: error: {{.*}}gdb-index-invalid-ranges.s.tmp.a(gdb-index-invalid-ranges.s.tmp.o):(.debug_info): decoding address ranges: invalid range list entry at offset 0x10
8+
# CHECK: ld.lld: warning: {{.*}}gdb-index-invalid-ranges.s.tmp.o:(.debug_info): decoding address ranges: invalid range list entry at offset 0x10
9+
# ARCHIVE: ld.lld: warning: {{.*}}gdb-index-invalid-ranges.s.tmp.a(gdb-index-invalid-ranges.s.tmp.o):(.debug_info): decoding address ranges: invalid range list entry at offset 0x10
1010

1111
.section .text.foo1,"ax",@progbits
1212
.globl f1

lld/test/ELF/gdb-index-parse-fail.s

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
# REQUIRES: x86
22
# RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t1.o
3-
# RUN: not ld.lld --gdb-index %t1.o -o /dev/null 2>&1 | FileCheck %s
3+
# RUN: ld.lld --gdb-index %t1.o -o /dev/null 2>&1 | FileCheck %s
44

5-
# CHECK: error: {{.*}}:(.debug_info): invalid reference to or invalid content in .debug_str_offsets[.dwo]: insufficient space for 32 bit header prefix
5+
# CHECK: warning: {{.*}}:(.debug_info): invalid reference to or invalid content in .debug_str_offsets[.dwo]: insufficient space for 32 bit header prefix
66

77
.section .debug_abbrev,"",@progbits
88
.byte 1 # Abbreviation Code

0 commit comments

Comments
 (0)