public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug lto/108534] New: LTO streamer does not remap source directory
@ 2023-01-24 22:24 ian at airs dot com
  2023-01-25  0:13 ` [Bug lto/108534] " pinskia at gcc dot gnu.org
  2023-01-25  1:34 ` ian at airs dot com
  0 siblings, 2 replies; 3+ messages in thread
From: ian at airs dot com @ 2023-01-24 22:24 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 108534
           Summary: LTO streamer does not remap source directory
           Product: gcc
           Version: 13.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: lto
          Assignee: unassigned at gcc dot gnu.org
          Reporter: ian at airs dot com
                CC: marxin at gcc dot gnu.org
  Target Milestone: ---

The LTO streamer can pass the source directory through without calling
remap_debug_filename.  This path can escape into the debug information, which
can make it hard to create reproducible results when using LTO.

Specifically lto_output_location_1 writes the output of get_src_pwd into the
stream without calling remap_debug_filename.

This causes some complexity for Go tooling as discussed at the comment thread
starting at
https://go-review.googlesource.com/c/go/+/413974/15#message-4a4b317f08c2aee261b93c37c82a2bcab21830d8
.  Basically, the Go tool is trying to get a reproducible build using LTO, and
failing due to the inclusion of an unmapped directory.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Bug lto/108534] LTO streamer does not remap source directory
  2023-01-24 22:24 [Bug lto/108534] New: LTO streamer does not remap source directory ian at airs dot com
@ 2023-01-25  0:13 ` pinskia at gcc dot gnu.org
  2023-01-25  1:34 ` ian at airs dot com
  1 sibling, 0 replies; 3+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-01-25  0:13 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
          const char *remapped = remap_debug_filename (xloc.file);
          if (ob->emit_pwd && remapped && !IS_ABSOLUTE_PATH (remapped))
            {
              stream_pwd = true;
              ob->emit_pwd = false;
            }
          bp_pack_value (bp, stream_pwd, 1);
          if (stream_pwd)
            bp_pack_string (ob, bp, get_src_pwd (), true);



It specifically streams out the pwd if there was a remapping happening
and if the remapping was not an absolute path ....

So what options are being passed here? is the remapping in one case to a
relative path and then the cwd also gets remapped? Is that also being remapped
to a relative path?

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Bug lto/108534] LTO streamer does not remap source directory
  2023-01-24 22:24 [Bug lto/108534] New: LTO streamer does not remap source directory ian at airs dot com
  2023-01-25  0:13 ` [Bug lto/108534] " pinskia at gcc dot gnu.org
@ 2023-01-25  1:34 ` ian at airs dot com
  1 sibling, 0 replies; 3+ messages in thread
From: ian at airs dot com @ 2023-01-25  1:34 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Ian Lance Taylor <ian at airs dot com> ---
Yes, it's a relative path, such as

    #line 1 "cgo-gcc-prolog"

These are dummy but informative line markers used to separate generated code
from user-written code, so that compiler error messages report problems in the
right place.

The compiler is being executed in a temporary directory created during the
build, so the working directory is meaningless.  Other references to files in
that temporary directory are rewritten by a -fdebug-prefix-map option. 
Unfortunately, that option fails to rename the working directory that is pulled
in for the relative #line option.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2023-01-25  1:35 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-01-24 22:24 [Bug lto/108534] New: LTO streamer does not remap source directory ian at airs dot com
2023-01-25  0:13 ` [Bug lto/108534] " pinskia at gcc dot gnu.org
2023-01-25  1:34 ` ian at airs dot com

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).