bug-binutils
[Top][All Lists]
Advanced

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

[Bug gas/28266] CWD present in object file even after use of -fdebug-pre


From: joel at rosdahl dot net
Subject: [Bug gas/28266] CWD present in object file even after use of -fdebug-prefix-map=$PWD=foo
Date: Thu, 02 Sep 2021 07:04:33 +0000

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

--- Comment #3 from Joel Rosdahl <joel at rosdahl dot net> ---
(In reply to Nick Clifton from comment #2)
> So I would favour the interpretation that -fdebug-prefix-map is expected to
> override strict conformance to the DWARF standard because of the desire/need
> for reproducible builds.

Sounds good.

> Possibly it can be argued that in the presence of the -fdebug-prefix-map
> option the DW_AT_comp_dir entry ought to be changed as well. (Which would
> match the intention of creating reproducible builds).
> 
> The problem with this idea is that it is GCC not GAS that generates the
> DW_AT_comp_dir entry, and detecting it reliably in the assembler would quite
> hard. But maybe GCC can be persuaded to do this instead ?
> [...]
> So gas and Clang are in sync on this ?  Good.

Hmm, sounds like I probably was unclear in my original description.
DW_AT_comp_dir is already changed by -fdebug-prefix-map, but the 0'th directory
table entry is not (after 3417bfca676ff0b440f070a09837813e99b2c731).

Here is how to reproduce the issue:

    % cd /tmp
    % echo 'int x;' >test.c
    % /usr/bin/gcc -g -fdebug-prefix-map=/tmp=/example -c test.c
    % objdump -W test.o 2>/dev/null | grep -E '/tmp|/example'
        <16>   DW_AT_comp_dir    : (indirect line string, offset: 0x0):
/example
      0     (indirect line string, offset: 0x10): /tmp
      1     (indirect line string, offset: 0x15): /example
      0x00000000 2f657861 6d706c65 00746573 742e6300 /example.test.c.
      0x00000010 2f746d70 002f6578 616d706c 65007465 /tmp./example.te

DW_AT_comp_dir is rewritten according to -fdebug-prefix-map but the 0'th
directory table entry is still "/tmp".

With Clang there is no trace of "/tmp":

    % cd /tmp
    % echo 'int x;' >test.c
    % /usr/bin/clang -gdwarf-5 -fdebug-prefix-map=/tmp=/example -c test.c
    % objdump -W test.o 2>/dev/null | grep -E '/tmp|/example'
               2       33 /example
      0x00000030 2e63002f 6578616d 706c6500 7800696e .c./example.x.in
      0     (indirect line string, offset: 0x0): /example
      0x00000000 2f657861 6d706c65 00746573 742e6300 /example.test.c.

-- 
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]