public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "tonyb at cybernetics dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug debug/101473] debug_line info depends on toolchain path
Date: Tue, 20 Jul 2021 17:58:11 +0000	[thread overview]
Message-ID: <bug-101473-4-M8cYIoj6O2@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-101473-4@http.gcc.gnu.org/bugzilla/>

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

--- Comment #17 from tonyb at cybernetics dot com ---
(In reply to Richard Biener from comment #16)
> I'm interested if remaining differences are due to the same underlying issue
> or not

I tested your updated patch with gcc 10.2 (I had to make a small change due to
the definition of struct dwarf_file_data being in dwarf2out.c rather than
dwarf2out.h in gcc 10.2).  I got the same results as before, with the same list
of files being non-reproducible.  I decided to debug the problem with pciutils.
 For pciutils, the problem was caused by the following:

Yocto CFLAGS contains -ffile-prefix-map but LDFLAGS doesn't.
The pciutils Makefile compiles *.c files to *.o files with CFLAGS and links
them with LDFLAGS but not CFLAGS.
With LTO disabled, this results in a reproducible binary, but with LTO enabled,
this results in a non-reproducible binary.

So I can workaround by adding -ffile-prefix-map to LDFLAGS.

So is this considered a bug?  If the prefix map translation can be handled
completely before generating the *.o file, then it could be fixed in gcc, but I
am not sure how it all works.  One solution that is apparently off the table is
embedding the prefix map in the *.o file, since that would make the *.o file
non-reproducible (see e.g. bug 68848; apparently the prefix map used to be
present in the *.o file but was removed in some recent version of gcc).

If this issue is not considered a bug, then I will pass on to the Yocto people
that they should use -ffile-prefix-map in LDFLAGS in addition to CFLAGS, and
you can close this PR.

I haven't looked into the other packages that were not reproducible, but I
suspect the same issue.

I will attach a test script that shows the issue if you want to debug it
further.

  parent reply	other threads:[~2021-07-20 17:58 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-16 14:11 [Bug lto/101473] New: LTO makes debug info depend " tonyb at cybernetics dot com
2021-07-19  6:18 ` [Bug lto/101473] " rguenth at gcc dot gnu.org
2021-07-19  7:53 ` rguenth at gcc dot gnu.org
2021-07-19 13:12 ` tonyb at cybernetics dot com
2021-07-19 13:15 ` tonyb at cybernetics dot com
2021-07-19 13:22 ` rguenth at gcc dot gnu.org
2021-07-19 13:28 ` tonyb at cybernetics dot com
2021-07-19 14:06 ` [Bug debug/101473] debug_line info depends " rguenth at gcc dot gnu.org
2021-07-19 14:08 ` rguenth at gcc dot gnu.org
2021-07-19 14:10 ` rguenth at gcc dot gnu.org
2021-07-19 14:17 ` rguenth at gcc dot gnu.org
2021-07-19 14:58 ` tonyb at cybernetics dot com
2021-07-19 19:24 ` tonyb at cybernetics dot com
2021-07-20  7:10 ` rguenther at suse dot de
2021-07-20  9:06 ` rguenth at gcc dot gnu.org
2021-07-20 10:50 ` cvs-commit at gcc dot gnu.org
2021-07-20 10:51 ` rguenth at gcc dot gnu.org
2021-07-20 17:58 ` tonyb at cybernetics dot com [this message]
2021-07-20 18:02 ` tonyb at cybernetics dot com
2021-07-21 10:34 ` rguenth at gcc dot gnu.org
2021-07-21 11:04 ` jakub at gcc dot gnu.org
2021-07-21 13:40 ` tonyb at cybernetics dot com
2021-11-09 14:34 ` rguenth at gcc dot gnu.org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-101473-4-M8cYIoj6O2@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).