diff options
author | David Blaikie <dblaikie@gmail.com> | 2019-08-09 01:14:36 +0000 |
---|---|---|
committer | David Blaikie <dblaikie@gmail.com> | 2019-08-09 01:14:36 +0000 |
commit | 84b55e61ddd1c69fee68eb5ce47a89acee2b42b7 (patch) | |
tree | dee0ae5d66f88c31ea8df26f45daf787fe24d1bd | |
parent | 0fcc1f7bac6e70331039e39b743a1e46faa64951 (diff) | |
download | bcm5719-llvm-84b55e61ddd1c69fee68eb5ce47a89acee2b42b7.tar.gz bcm5719-llvm-84b55e61ddd1c69fee68eb5ce47a89acee2b42b7.zip |
DebugInfo: Explicitly handle errors when parsing unit DIEs
This ensures these errors produce a non-zero exit and improves the
context (providing the name of the input object and section being
parsed).
llvm-svn: 368378
-rw-r--r-- | lld/ELF/SyntheticSections.cpp | 4 | ||||
-rw-r--r-- | lld/test/ELF/gdb-index-parse-fail.s | 6 |
2 files changed, 6 insertions, 4 deletions
diff --git a/lld/ELF/SyntheticSections.cpp b/lld/ELF/SyntheticSections.cpp index bab6a8ab89e..817f1e170b7 100644 --- a/lld/ELF/SyntheticSections.cpp +++ b/lld/ELF/SyntheticSections.cpp @@ -2475,6 +2475,10 @@ 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))); + return {}; + } Expected<DWARFAddressRangesVector> ranges = cu->collectAddressRanges(); if (!ranges) { error(toString(sec) + ": " + toString(ranges.takeError())); diff --git a/lld/test/ELF/gdb-index-parse-fail.s b/lld/test/ELF/gdb-index-parse-fail.s index 2f4c00795b7..8b06a8d9228 100644 --- a/lld/test/ELF/gdb-index-parse-fail.s +++ b/lld/test/ELF/gdb-index-parse-fail.s @@ -1,10 +1,8 @@ # REQUIRES: x86 # RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t1.o -# RUN: ld.lld --gdb-index %t1.o -o %t 2>&1 | FileCheck %s +# RUN: not ld.lld --gdb-index %t1.o -o %t 2>&1 | FileCheck %s -# FIXME: ld.lld should return non-zero (add a "NOT" to start once this bug is fixed) - -# CHECK: error: invalid contribution to string offsets table +# CHECK: error: {{.*}}:(.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 |