gdb-index: Wire up str_offsets section to avoid incorrect error message about offsets_base

There's still a need for a deeper fix to the way libDebugInfoDWARF error
messages are propagated up to lld - if lld had exited non-zero on this
error message we would've found the issue sooner.

llvm-svn: 368229
This commit is contained in:
David Blaikie 2019-08-07 22:49:14 +00:00
parent ac136fc51f
commit 8a480d2cbf
3 changed files with 12 additions and 1 deletions

View File

@ -38,6 +38,7 @@ template <class ELFT> LLDDwarfObj<ELFT>::LLDDwarfObj(ObjFile<ELFT> *obj) {
.Case(".debug_info", &infoSection)
.Case(".debug_ranges", &rangesSection)
.Case(".debug_rnglists", &rnglistsSection)
.Case(".debug_str_offsets", &strOffsetsSection)
.Case(".debug_line", &lineSection)
.Default(nullptr)) {
m->Data = toStringRef(sec->data());

View File

@ -40,6 +40,10 @@ public:
return rnglistsSection;
}
const llvm::DWARFSection &getStrOffsetsSection() const override {
return strOffsetsSection;
}
const llvm::DWARFSection &getLineSection() const override {
return lineSection;
}
@ -79,6 +83,7 @@ private:
LLDDWARFSection infoSection;
LLDDWARFSection rangesSection;
LLDDWARFSection rnglistsSection;
LLDDWARFSection strOffsetsSection;
LLDDWARFSection lineSection;
LLDDWARFSection addrSection;
StringRef abbrevSection;

View File

@ -1,8 +1,13 @@
# 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
# RUN: ld.lld --gdb-index %t1.o -o %t 2>&1 | FileCheck --check-prefix=LLD %s
# RUN: llvm-dwarfdump -gdb-index %t | FileCheck %s
# FIXME: Remove this once lld correctly returns non-zero on errors like this
# There's no other behavior to test hidden behind this error - lld only parses
# the CU for the address ranges, it doesn't need to decode any strings.
# LLD-NOT: error:
## The code contains DWARF v5 sections .debug_rnglists and .debug_addr.
## Check we are able to build the correct address
## area using address range lists.