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

--- Comment #1 from Simon Marchi <simon.marchi at polymtl dot ca> ---
Looking at the .s, I see that gcc attempts to pass "/tmp/cwd/test.c" as the
name of the file at index 0:

  .file 0 "/home/simark" "/tmp/cwd/test.c"

If gas did put "/tmp/cwd/test.c" as the name in the line table header, it would
be fine.  But in the gas doc [1]:

> When emitting DWARF2 line number information, .file assigns filenames to the 
> .debug_line file name table. The syntax is:
> 
> .file fileno filename
> 
> The fileno operand should be a unique positive integer to use as the index of 
> the entry in the table. The filename operand is a C string literal enclosed 
> in double quotes. The filename can include directory elements. If it does, 
> then the directory will be added to the directory table and the basename will 
> be added to the file table. 

So, gas always only puts the basename as the name in the line table header,
that's why we end up with just "test.c".

[1] https://sourceware.org/binutils/docs/as/File.html#File

Reply via email to