bug-binutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug binutils/29535] New: Invalid combination of debug info attributes D


From: ralf.habacker at freenet dot de
Subject: [Bug binutils/29535] New: Invalid combination of debug info attributes DW_AT_name and DW_AT_comp_dir with absolute source file path
Date: Mon, 29 Aug 2022 10:48:10 +0000

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

            Bug ID: 29535
           Summary: Invalid combination of debug info attributes
                    DW_AT_name and DW_AT_comp_dir with absolute source
                    file path
           Product: binutils
           Version: 2.39
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: binutils
          Assignee: unassigned at sourceware dot org
          Reporter: ralf.habacker at freenet dot de
  Target Milestone: ---

When using source files with absolute paths, gas generates an invalid
combination of the DW_AT_name and DW_AT_comp_dir dwarf attributes

See the following test case: 

mkdir -p ~/src/test-binutils && cd ~/src/test-binutils
cat << EOF > test.c 
#include <stdio.h>

int main()
{   
    printf("hello world");
    return 0;
}
EOF

mkdir output
mkdir build && cd build
gcc -o ../output/test ../test.c -g

objdump -Wi ../output/test
...
 <0><9a>: Abbrev Number: 1 (DW_TAG_compile_unit)
    <9b>   DW_AT_producer    : (indirect string, offset: 0x1dd): GNU C11 7.5.0
-C -mtune=generic -march=x86-64 -g
    <9f>   DW_AT_language    : 12       (ANSI C99)
    <a0>   DW_AT_name        : (indirect string, offset: 0x3e4): ../test.c
    <a4>   DW_AT_comp_dir    : (indirect string, offset: 0x33b):
/home/<user>/src/test-binutils/build

Combining DW_AT_name, '/' and DW_AT_comp_dir returns the correct path to the
used source file.

The same result is also found in the generated object files, as shown below,
shifting the responsibility for this result to gas.

gcc -C -o test-rel.o ../test.c -g
objdump -Wi test-rel.o 
...
 <0><9a>: Abbrev Number: 1 (DW_TAG_compile_unit)
    <9b>   DW_AT_producer    : (indirect string, offset: 0x1dd): GNU C11 7.5.0
-C -mtune=generic -march=x86-64 -g
    <9f>   DW_AT_language    : 12       (ANSI C99)
    <a0>   DW_AT_name        : (indirect string, offset: 0x3e4): ../test.c
    <a4>   DW_AT_comp_dir    : (indirect string, offset: 0x33b):
/home/<user>/src/test-binutils/build

The problem happens when using absolute paths:

gcc -C -o test.o ~/src/test-binutils/test.c -g
objdump -Wi test.o 

<0><9a>: Abbrev Number: 1 (DW_TAG_compile_unit)
    <9b>   DW_AT_producer    : (indirect string, offset: 0x1dd): GNU C11 7.5.0
-C -mtune=generic -march=x86-64 -g
    <9f>   DW_AT_language    : 12       (ANSI C99)
    <a0>   DW_AT_name        : (indirect string, offset: 0x286):
/home/<user>/src/test-binutils/test.c
    <a4>   DW_AT_comp_dir    : (indirect string, offset: 0x345):
/home/<user>/src/test-binutils/build

The combination of both attributes leads to an invalid path.

The follwing binutils version has been used to report the issue:

objdump --version
GNU objdump (GNU Binutils; devel:gcc / openSUSE_Leap_15.3)
2.39.0.20220810-lp153.470

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


reply via email to

[Prev in Thread] Current Thread [Next in Thread]