[lld] r368229 - gdb-index: Wire up str_offsets section to avoid incorrect error message about offsets_base

David Blaikie via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 7 15:49:15 PDT 2019


Author: dblaikie
Date: Wed Aug  7 15:49:14 2019
New Revision: 368229

URL: http://llvm.org/viewvc/llvm-project?rev=368229&view=rev
Log:
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.

Modified:
    lld/trunk/ELF/DWARF.cpp
    lld/trunk/ELF/DWARF.h
    lld/trunk/test/ELF/gdb-index-rng-lists.s

Modified: lld/trunk/ELF/DWARF.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/DWARF.cpp?rev=368229&r1=368228&r2=368229&view=diff
==============================================================================
--- lld/trunk/ELF/DWARF.cpp (original)
+++ lld/trunk/ELF/DWARF.cpp Wed Aug  7 15:49:14 2019
@@ -38,6 +38,7 @@ template <class ELFT> LLDDwarfObj<ELFT>:
                 .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());

Modified: lld/trunk/ELF/DWARF.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/DWARF.h?rev=368229&r1=368228&r2=368229&view=diff
==============================================================================
--- lld/trunk/ELF/DWARF.h (original)
+++ lld/trunk/ELF/DWARF.h Wed Aug  7 15:49:14 2019
@@ -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;

Modified: lld/trunk/test/ELF/gdb-index-rng-lists.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/gdb-index-rng-lists.s?rev=368229&r1=368228&r2=368229&view=diff
==============================================================================
--- lld/trunk/test/ELF/gdb-index-rng-lists.s (original)
+++ lld/trunk/test/ELF/gdb-index-rng-lists.s Wed Aug  7 15:49:14 2019
@@ -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.




More information about the llvm-commits mailing list