From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 522823858D32; Mon, 15 May 2023 06:34:31 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 522823858D32 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1684132471; bh=cxfyrsyh9UET7/J+Rn/cWDSH40Ot9fXhTBNAd9Fhz6k=; h=From:To:Subject:Date:In-Reply-To:References:From; b=MN+kwmzL5KAtqgeKhuoHjLF8L/xE0E4CMlaLjUuQ1DyPuvP+oVGMj9h4P0zJ8RgC5 SGivy8qHTDHtyEJT1KYhpuqVIkSwaEUa/I4xBAXAZw+rDpjZdSSmrbmEYusTfD/osN mxTar+lEWm1sUrEDefI2McfFquMYUXqHAXTbeiH0= From: "rguenth at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug debug/109805] LTO affecting -fdebug-prefix-map Date: Mon, 15 May 2023 06:34:30 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: debug X-Bugzilla-Version: 14.0 X-Bugzilla-Keywords: lto X-Bugzilla-Severity: normal X-Bugzilla-Who: rguenth at gcc dot gnu.org X-Bugzilla-Status: ASSIGNED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: rguenth at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: cc Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D109805 Richard Biener changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |jakub at gcc dot gnu.org --- Comment #10 from Richard Biener --- (In reply to Sergio Durigan Junior from comment #9) > at(In reply to Richard Biener from comment #8) > > This works for me. The consistency check is not fully implemented and > > instead > > of passing down no -fdebug-prefix-map the patch passes the first but wa= rns: > > > > > ./xgcc -B. t.o t2.o -o t > > lto-wrapper: warning: option > > -fdebug-prefix-map=3D/home/rguenther/obj-trunk-g/gcc=3D/bbb with differ= ent > > values, using /home/rguenther/obj-trunk-g/gcc=3D/aaa > > > > to make consistency checking work we need to record -fcanon-prefix-map > > and the full set of -f{file,debug}-prefix-map options in order (I think > > file and debug variants can be considered the same) of the first TU and > > compare that to each of the following TUs. >=20 > Thanks a lot for the patch. I tried it locally, and it indeed works for = the > simple example I posted in the description of this bug. However, for some > reason it doesn't seem to make a difference for the vim compilation. I'm > still seeing a directory table like the following: >=20 > Directory table: > [path(line_strp)] > 0 /home/ubuntu/vim/vim-9.0.1378/src/vim-basic (0) > 1 /usr/include/x86_64-linux-gnu/bits (57) > 2 /usr/include (92) >=20 > whereas if I pass -fdebug-prefix-map to LDFLAGS, the directory table beco= mes: >=20 > Directory table: > [path(line_strp)] > 0 /usr/src/vim-2:9.0.1378-2ubuntu2~ppa1/src/vim-basic (0) > 1 /usr/include/x86_64-linux-gnu/bits (65) > 2 /usr/include (100) >=20 > which is what I expected to see. Odd. > > Note a link-time specified option will simply ignore all options from t= he > > compile-time (but only for the link-time unit, the compile-time debug i= nfo > > has already been generated with the originally specified options). >=20 > FWIW, I think this bug is related to #108534 (and the related discussion = at > https://gcc.gnu.org/pipermail/gcc-patches/2022-November/606205.html). Yes, that looks related. Note we do remap the file part of locations but indeed not the streamed PWD. When I remap PWD as well I get The Directory Table (offset 0x10a, lines 2, columns 1): Entry Name 0 (indirect line string, offset: 0x18): /aaa 1 (indirect line string, offset: 0xd): ../../../../aaa The File Name Table (offset 0x118, lines 2, columns 2): Entry Dir Name 0 0 (indirect line string, offset: 0x0): 1 1 (indirect line string, offset: 0x1d): t.c for the toy example. That's quite odd, but possibly the behavior of the original intent of the patch you quoted - but it also shows that the remapping of the streamed PWD is likely wrong? For the record the above is with just diff --git a/gcc/lto-streamer-out.cc b/gcc/lto-streamer-out.cc index 0bca530313c..89b602f080b 100644 --- a/gcc/lto-streamer-out.cc +++ b/gcc/lto-streamer-out.cc @@ -231,7 +231,8 @@ lto_output_location_1 (struct output_block *ob, struct bitpack_d *bp, } bp_pack_value (bp, stream_pwd, 1); if (stream_pwd) - bp_pack_string (ob, bp, get_src_pwd (), true); + bp_pack_string (ob, bp, remap_debug_filename (get_src_pwd ()), + true); bp_pack_string (ob, bp, remapped, true); bp_pack_value (bp, xloc.sysp, 1); } r10-6887-gd12153046816f9 did the original bits of remapping and shows we originally passed through the remapping options. r11-3096-g3d0af0c997fe42 was Jakubs fix for .debug_line and relative paths vs. changing CWD.=