[Bug debug/105088] Small DWARF 5 spec violation in line table when passing an absolute path

mark at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Tue Mar 29 12:24:16 GMT 2022


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105088

--- Comment #11 from Mark Wielaard <mark at gcc dot gnu.org> ---
I believe the intention of the DWARF5 spec as that dir entry zero would be
equal to the comp_dir attribute of the CU and file entry zero would be equal to
the name attribute of the CU.

Also, although the spec does not explicitly seem to say so, consumers take an
absolute source path to mean that the file isn't relative to the compilation
dir.

So if the current working directory is my home dir and I compile a source file
/tmp/test.c then I would expect the Compile Unit DIE to have the following two
attributes:

           name                 (line_strp) "/tmp/test.c"
           comp_dir             (line_strp) "/home/mark"

And the dir/line table to match with:

Directory table:
      [path(line_strp)]
 0     /home/mark (23)

File name table:
      [path(line_strp), directory_index(udata)]
 0     /tmp/test.c (52),  0

gcc tries to make that happen using the following .file 0 entry:

        .file 0 "/home/mark" "/tmp/test.c"

So if that is no longer the case, then I think binutils gas is getting this
wrong now.


More information about the Gcc-bugs mailing list