[Bug general/27367] readelf: invalid loclists data with -ffat-lto-objects

mark at klomp dot org sourceware-bugzilla@sourceware.org
Mon Feb 8 11:14:16 GMT 2021


https://sourceware.org/bugzilla/show_bug.cgi?id=27367

Mark Wielaard <mark at klomp dot org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
     Ever confirmed|0                           |1
   Last reconfirmed|                            |2021-02-08
             Status|UNCONFIRMED                 |NEW
                 CC|                            |mark at klomp dot org

--- Comment #4 from Mark Wielaard <mark at klomp dot org> ---
Same for git HEAD/0.183

Without -flto and -ffat-lto-objects this looks like:

DWARF section [ 7] '.debug_loclists' at offset 0xff:
Table at Offset 0x0:

 Length:               24
 DWARF version:         5
 Address size:          8
 Segment size:          0
 Offset entries:        0
 CU [     c] base: .text+000000000000000000 <main_argc>

  Offset: c, Index: 0
    view pair 2, 3

  Offset: e, Index: 2
    start_length 0x0, 0
      .text+000000000000000000 <main_argc>..
      0xffffffffffffffff
        [ 0] lit0
        [ 1] stack_value
    end_of_list

Note that it starts with a view pair, and in the non-lto variant eu-readelf
does know which CU this is associated with, while in the lto variant it says
"Not associated with a CU."

The issue seems to be that eu-readelf seeing both .debug_info and
.gnu.debuglto_.debug_info (you get both when using -ffat-lto-objects) picks the
.gnu.debuglto_.debug_info and drops/skips the .debug_info.

The following "fixes" it:

diff --git a/libdw/dwarf_begin_elf.c b/libdw/dwarf_begin_elf.c
index 757ac4fa..49ec0f22 100644
--- a/libdw/dwarf_begin_elf.c
+++ b/libdw/dwarf_begin_elf.c
@@ -137,10 +137,10 @@ check_section (Dwarf *result, size_t shstrndx, Elf_Scn
*scn, bool inscngrp)
          gnu_compressed = true;
          break;
        }
-      else if (scnlen > 14 /* .gnu.debuglto_ prefix. */
-              && strncmp (scnname, ".gnu.debuglto_", 14) == 0
-              && strcmp (&scnname[14], dwarf_scnnames[cnt]) == 0)
-       break;
+//      else if (scnlen > 14 /* .gnu.debuglto_ prefix. */
+//            && strncmp (scnname, ".gnu.debuglto_", 14) == 0
+//            && strcmp (&scnname[14], dwarf_scnnames[cnt]) == 0)
+//     break;
     }

   if (cnt >= ndwarf_scnnames)

But of course that breaks showing .gnu.debuglto_ sections...

-- 
You are receiving this mail because:
You are on the CC list for the bug.


More information about the Elfutils-devel mailing list