public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "rguenth at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug debug/101473] debug_line info depends on toolchain path
Date: Wed, 21 Jul 2021 10:34:50 +0000	[thread overview]
Message-ID: <bug-101473-4-vqOFXuTSHp@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 #19 from Richard Biener <rguenth at gcc dot gnu.org> ---
I think it is a bug - -fdebug-prefix-map should be fully reflected in the LTO
IL and thus we should not end up creating un-remapped references to files (we
should not create many references to files late anyway).

In particular we're remapping all files when streaming locations to LTO.  But
yes, we're explicitely _not_ streaming the -f*-prefix-map arguments since
we'd have a hard time using them when they do not agree between TUs.

Your lto-test shows the difference is in the LTRANS DWARF CU header:

@@ -215,7 +215,7 @@
     <9b>   DW_AT_producer    : (indirect string, offset: 0x1c7): GNU GIMPLE
10.3.0 -mtune=generic -march=x86-64 -g -O2 -fno-openmp -fno-openacc -fno-pie
-fcf-protection=none -ffat-lto-objects -fuse-linker-plugin -fltrans
     <9f>   DW_AT_language    : 12      (ANSI C99)
     <a0>   DW_AT_name        : (indirect string, offset: 0x1b2): <artificial>
-    <a4>   DW_AT_comp_dir    : (indirect string, offset: 0x263):
/tmp/lto-test/src0
+    <a4>   DW_AT_comp_dir    : (indirect string, offset: 0x263):
/tmp/lto-test/src1
     <a8>   DW_AT_ranges      : 0x40
     <ac>   DW_AT_low_pc      : 0x0
     <b4>   DW_AT_stmt_list   : 0xe8

and with DWARF5 in addition in the directory table:

  The Directory Table (offset 0x10a, lines 1, columns 1):
   Entry        Name
-  0    (indirect line string, offset: 0xd): /tmp/lto-test/src0
+  0    (indirect line string, offset: 0xd): /tmp/lto-test/src1

so indeed the prefix remapping is needed at link-time - the link time
CWD aka DW_AT_comp_dir might also not agree with the CWD at compile time.

Thus my suggestion would be to indeed add -f*-prefix-map to LDFLAGS,
at least I can't think of a good solution to the above issue.  Eventually
picking a random TU and copying the CWD from its compile-time to the
link-time CUs would work.  Or somehow not specifying a compilation-dir
at all for those CUs?

  parent reply	other threads:[~2021-07-21 10:34 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
2021-07-20 18:02 ` tonyb at cybernetics dot com
2021-07-21 10:34 ` rguenth at gcc dot gnu.org [this message]
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-vqOFXuTSHp@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).