gcc

Comment 15 for bug 2019160

Revision history for this message
In , Rguenth (rguenth) wrote :

Btw, streaming of the CWD is prone to breakage when it changes between preprocessing and compilation stage. I think at least for C family languages
the CWD would need to be recorded by the preprocessor and made available
via line directives somehow?

This also seems "wrong" without LTO.

> ls t.c tmp
t.c

tmp:
t.h t.o
> gcc -E t.c -o t.i
> cd tmp
> gcc ../t.i -g .c
> readelf -w t.o
...
 <0><b>: Abbrev Number: 1 (DW_TAG_compile_unit)
    <c> DW_AT_producer : (indirect string, offset: 0x0): GNU C17 12.2.1 20220830 [revision e927d1cf141f221c5a32574bde0913307e140984] -mtune=generic -march=x86-64 -g
    <10> DW_AT_language : 12 (ANSI C99)
    <11> DW_AT_name : t.c
    <15> DW_AT_comp_dir : (indirect string, offset: 0x71): /tmp/tmp
...
 The Directory Table (offset 0x1c):
  1 tmp

 The File Name Table (offset 0x21):
  Entry Dir Time Size Name
  1 0 0 0 t.c
  2 1 0 0 t.h

and LTO just adds another level of "directory changing" (but for sure a more
common one).