return Ret;
}
-static Expected<std::vector<GdbIndexSection::AddressEntry>>
+static std::vector<GdbIndexSection::AddressEntry>
readAddressAreas(DWARFContext &Dwarf, InputSection *Sec) {
std::vector<GdbIndexSection::AddressEntry> Ret;
uint32_t CuIdx = 0;
for (std::unique_ptr<DWARFUnit> &Cu : Dwarf.compile_units()) {
Expected<DWARFAddressRangesVector> Ranges = Cu->collectAddressRanges();
- if (!Ranges)
- return Ranges.takeError();
+ if (!Ranges) {
+ error(toString(Sec) + ": " + toString(Ranges.takeError()));
+ return {};
+ }
ArrayRef<InputSectionBase *> Sections = Sec->File->getSections();
for (DWARFAddressRange &R : *Ranges) {
++CuIdx;
}
- return std::move(Ret);
+ return Ret;
}
template <class ELFT>
Chunks[I].Sec = Sections[I];
Chunks[I].CompilationUnits = readCuList(Dwarf);
- Expected<std::vector<GdbIndexSection::AddressEntry>> AddressAreas =
- readAddressAreas(Dwarf, Sections[I]);
- if (!AddressAreas) {
- std::string Msg = File->getName();
- Msg += ": ";
- if (!File->ArchiveName.empty())
- Msg += "in archive " + File->ArchiveName + ": ";
- Msg += toString(AddressAreas.takeError());
- fatal(Msg);
- }
- Chunks[I].AddressAreas = *AddressAreas;
+ Chunks[I].AddressAreas = readAddressAreas(Dwarf, Sections[I]);
NameAttrs[I] = readPubNamesAndTypes<ELFT>(
static_cast<const LLDDwarfObj<ELFT> &>(Dwarf.getDWARFObj()),
Chunks[I].CompilationUnits);
# RUN: llvm-ar rc %t.a %t.o
# RUN: not ld.lld --gdb-index -e main %t2.o %t.a -o %t 2>&1 | FileCheck --check-prefix=ARCHIVE %s
-# CHECK: ld.lld: error: {{.*}}gdb-index-invalid-ranges.s.tmp.o: decoding address ranges: invalid range list entry at offset 0x10
-# ARCHIVE: ld.lld: error: gdb-index-invalid-ranges.s.tmp.o: in archive {{.*}}gdb-index-invalid-ranges.s.tmp.a: decoding address ranges: invalid range list entry at offset 0x10
+# 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
.section .text.foo1,"ax",@progbits
.globl f1