[LLD] Report errors occurred while parsing debug info as warnings.
authorAlexey Lapshin <a.v.lapshin@mail.ru>
Thu, 27 Feb 2020 10:21:58 +0000 (13:21 +0300)
committerAlexey Lapshin <a.v.lapshin@mail.ru>
Fri, 28 Feb 2020 21:03:18 +0000 (00:03 +0300)
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

lld/ELF/SyntheticSections.cpp
lld/test/ELF/gdb-index-invalid-ranges.s
lld/test/ELF/gdb-index-parse-fail.s

index 8fede224b56d3984ea00415fc106e3cc4208bbaf..5de3df867c9f18718d82949eee64c8a420688ab8 100644 (file)
@@ -2668,12 +2668,12 @@ readAddressAreas(DWARFContext &dwarf, InputSection *sec) {
   uint32_t cuIdx = 0;
   for (std::unique_ptr<DWARFUnit> &cu : dwarf.compile_units()) {
     if (Error e = cu->tryExtractDIEsIfNeeded(false)) {
-      error(toString(sec) + ": " + toString(std::move(e)));
+      warn(toString(sec) + ": " + toString(std::move(e)));
       return {};
     }
     Expected<DWARFAddressRangesVector> ranges = cu->collectAddressRanges();
     if (!ranges) {
-      error(toString(sec) + ": " + toString(ranges.takeError()));
+      warn(toString(sec) + ": " + toString(ranges.takeError()));
       return {};
     }
 
index f146171314927af76cca34c2ba9e8ef954189666..93e612e62ed443378ae68b8c189d9020b5e56207 100644 (file)
@@ -1,12 +1,12 @@
 # REQUIRES: x86
 # RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t.o
-# RUN: not ld.lld --gdb-index -e main %t.o -o /dev/null 2>&1 | FileCheck %s
+# RUN: ld.lld --gdb-index -e main %t.o -o /dev/null 2>&1 | FileCheck %s
 # RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %p/Inputs/gdb-index-invalid-ranges.obj.s -o %t2.o
 # RUN: llvm-ar rc %t.a %t.o
-# RUN: not ld.lld --gdb-index -e main %t2.o %t.a -o /dev/null 2>&1 | FileCheck --check-prefix=ARCHIVE %s
+# RUN: ld.lld --gdb-index -e main %t2.o %t.a -o /dev/null 2>&1 | FileCheck --check-prefix=ARCHIVE %s
 
-# CHECK: ld.lld: error: {{.*}}gdb-index-invalid-ranges.s.tmp.o:(.debug_info): decoding address ranges: invalid range list entry at offset 0x10
-# 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
+# CHECK: ld.lld: warning: {{.*}}gdb-index-invalid-ranges.s.tmp.o:(.debug_info): decoding address ranges: invalid range list entry at offset 0x10
+# 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
 
 .section .text.foo1,"ax",@progbits
 .globl f1
index 22ac5cc8a839620612bae685ffb356509676633c..2e814a4031b75db95c3ac3a02e26e97ac2176cda 100644 (file)
@@ -1,8 +1,8 @@
 # REQUIRES: x86
 # RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t1.o
-# RUN: not ld.lld --gdb-index %t1.o -o /dev/null 2>&1 | FileCheck %s
+# RUN: ld.lld --gdb-index %t1.o -o /dev/null 2>&1 | FileCheck %s
 
-# CHECK: error: {{.*}}:(.debug_info): invalid reference to or invalid content in .debug_str_offsets[.dwo]: insufficient space for 32 bit header prefix
+# CHECK: warning: {{.*}}:(.debug_info): invalid reference to or invalid content in .debug_str_offsets[.dwo]: insufficient space for 32 bit header prefix
 
 .section .debug_abbrev,"",@progbits
   .byte  1                           # Abbreviation Code