summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lld/ELF/SyntheticSections.cpp4
-rw-r--r--lld/test/ELF/gdb-index-parse-fail.s6
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
OpenPOWER on IntegriCloud