[llvm-bugs] [Bug 42401] New: Corrupt debug info when using lld with gcc 9.1

via llvm-bugs llvm-bugs at lists.llvm.org
Wed Jun 26 00:49:03 PDT 2019


https://bugs.llvm.org/show_bug.cgi?id=42401

            Bug ID: 42401
           Summary: Corrupt debug info when using lld with gcc 9.1
           Product: lld
           Version: unspecified
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: ELF
          Assignee: unassignedbugs at nondot.org
          Reporter: sichert at in.tum.de
                CC: llvm-bugs at lists.llvm.org, peter.smith at linaro.org

I have the following program:

foo.cpp:

int foo() {
    return 1;
}


main.cpp:

int main() {
    return 0;
}



If I compile it with gcc 9.1 like this:

gcc -g -fuse-ld=lld -o main foo.cpp main.cpp

I get corrupted debug info. gdb says:

Reading symbols from main...
Dwarf Error: wrong version in compilation unit header (is 1024, should be 2, 3,
4 or 5) [in module <...>/main]
(No debugging symbols found in main)


This is the output of "readelf --debug-dump=info main":

Contents of the .debug_info section:

  Compilation Unit @ offset 0x0:
   Length:        0x53 (32-bit)
   Version:       4
   Abbrev Offset: 0x0
   Pointer Size:  8
 <0><b>: Abbrev Number: 1 (DW_TAG_compile_unit)
    <c>   DW_AT_producer    : (indirect string, offset: 0x31): GNU C++14 9.1.0
-mtune=generic -march=x86-64 -g -fuse-ld=lld
    <10>   DW_AT_language    : 4        (C++)
    <11>   DW_AT_name        : (indirect string, offset: 0x6e): foo.cpp
    <15>   DW_AT_comp_dir    : (indirect string, offset: 0x0): <...>
    <19>   DW_AT_low_pc      : 0x10f9
    <21>   DW_AT_high_pc     : 0xb
    <29>   DW_AT_stmt_list   : 0x0
 <1><2d>: Abbrev Number: 2 (DW_TAG_subprogram)
    <2e>   DW_AT_external    : 1
    <2e>   DW_AT_name        : foo
    <32>   DW_AT_decl_file   : 1
    <33>   DW_AT_decl_line   : 1
    <34>   DW_AT_decl_column : 5
    <35>   DW_AT_linkage_name: (indirect string, offset: 0x24): _Z3foov
    <39>   DW_AT_type        : <0x4f>
    <3d>   DW_AT_low_pc      : 0x10f9
    <45>   DW_AT_high_pc     : 0xb
    <4d>   DW_AT_frame_base  : 1 byte block: 9c         (DW_OP_call_frame_cfa)
    <4f>   DW_AT_GNU_all_call_sites: 1
 <1><4f>: Abbrev Number: 3 (DW_TAG_base_type)
    <50>   DW_AT_byte_size   : 4
    <51>   DW_AT_encoding    : 5        (signed)
    <52>   DW_AT_name        : int
 <1><56>: Abbrev Number: 0
readelf: Warning: Invalid pointer size (59) in compunit header, using 4 instead
  Compilation Unit @ offset 0x57:
   Length:        0x4f00 (32-bit)
   Version:       1024
   Abbrev Offset: 0x8000000
   Pointer Size:  4
readelf: Warning: Debug info is corrupted, .debug_info header at 0x57 has
length 4f00



This problem does not occur when using ld or gold. Also, it doesn't happen when
using gcc < 9.1 or clang.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20190626/42b03d69/attachment.html>


More information about the llvm-bugs mailing list