From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 185D93858C20; Thu, 11 May 2023 00:48:12 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 185D93858C20 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1683766092; bh=1/xTi8lj8hXN9i9y/41n/QWqtkkDzBycZGK2SGz1b5A=; h=From:To:Subject:Date:From; b=DTle8E/SnCoOkOb80obtk4ge8qV3SDpt4Fxv0a/dDF7EXw+4TC3W+jzLdy/1Qe8h8 SA091yfqroAbkFime1+7sNKRxWENHUYXe7htMVYX5/0Tj6uelw8ugN1tWm4MwBvoa/ YNk1ob/38Urs7msTAltYYAidp1TkFrWAaHU0AjW4= From: "sergiodj at sergiodj dot net" To: gcc-bugs@gcc.gnu.org Subject: [Bug debug/109805] New: LTO affecting -fdebug-prefix-map Date: Thu, 11 May 2023 00:48:11 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: debug X-Bugzilla-Version: 14.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: sergiodj at sergiodj dot net X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter target_milestone Message-ID: 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 Bug ID: 109805 Summary: LTO affecting -fdebug-prefix-map Product: gcc Version: 14.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: debug Assignee: unassigned at gcc dot gnu.org Reporter: sergiodj at sergiodj dot net Target Milestone: --- Hi, In Ubuntu we use -fdebug-prefix-map to remap a package's build directory (w= hich contains random stuff) into a predictable path under /usr/src. This is don= e in order to help debuginfod index the source code for our packages. Things work very well, but I found a weird corner case involving LTO. The affected package is vim. You can see the build logs for it here: https://launchpadlibrarian.net/665520301/buildlog_ubuntu-mantic-amd64.vim_2= %3A9.0.1378-2ubuntu1_BUILDING.txt.gz As you can notice, we're using -fdebug-prefix-map and LTO for the build. The problem is that the resulting debuginfo doesn't have the remaped direct= ory. I can replicate the issue locally, and at first I thought this was either = bug #108464 or #87726, but after some digging I'm convinced it's something else= .=20 I've compiled gcc (GCC) 14.0.0 20230510 from the master branch (608e7f3ab47fe746279c552c3574147aa3d8ee76), and I still can reproduce the problem. A simple reproducer for the problem follows: $ echo 'int main(){}' > foo.c $ ~/gcc/install/bin/gcc -c foo.c -O2 -g -flto=3Dauto -ffat-lto-objects -fdebug-prefix-map=3D`pwd`=3D/aaaaaaa -o foo= $ ~/gcc/install/bin/gcc foo -flto=3Dauto -ffat-lto-objects -o bar A workaround for this bug is to either stop using LTO or explicitly set -fdebug-prefix-map when linking the object.=