[Bug 2019160] [NEW] LTO affecting -fdebug-prefix-map

Sergio Durigan Junior 2019160 at bugs.launchpad.net
Thu May 11 00:49:32 UTC 2023


Public bug reported:

In Ubuntu we use -fdebug-prefix-map to remap a package's build directory
(which contains random stuff) into a predictable path under /usr/src.
This is done 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
directory.  I can replicate the issue locally, and at first I thought
this was either upstream bugs #108464 or #87726, but after some digging
I'm convinced it's something else.  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=auto -ffat-lto-objects -fdebug-prefix-map=`pwd`=/aaaaaaa -o foo
$ ~/gcc/install/bin/gcc foo -flto=auto -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.

** Affects: gcc
     Importance: Unknown
         Status: Unknown

** Affects: gcc-12 (Ubuntu)
     Importance: High
     Assignee: Sergio Durigan Junior (sergiodj)
         Status: New

** Affects: gcc-13 (Ubuntu)
     Importance: High
     Assignee: Sergio Durigan Junior (sergiodj)
         Status: New


** Tags: server-todo

** Changed in: gcc-13 (Ubuntu)
   Importance: Undecided => High

** Also affects: gcc-12 (Ubuntu)
   Importance: Undecided
       Status: New

** Changed in: gcc-12 (Ubuntu)
   Importance: Undecided => High

** Changed in: gcc-12 (Ubuntu)
     Assignee: (unassigned) => Sergio Durigan Junior (sergiodj)

** Tags added: server-todo

** Bug watch added: GCC Bugzilla #109805
   https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109805

** Also affects: gcc via
   https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109805
   Importance: Unknown
       Status: Unknown

** Description changed:

  In Ubuntu we use -fdebug-prefix-map to remap a package's build directory
  (which contains random stuff) into a predictable path under /usr/src.
  This is done 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
  directory.  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.  I've compiled gcc (GCC) 14.0.0 20230510
- from the master branch (608e7f3ab47fe746279c552c3574147aa3d8ee76), and I
- still can reproduce the problem.
+ this was either upstream bugs #108464 or #87726, but after some digging
+ I'm convinced it's something else.  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=auto -ffat-lto-objects -fdebug-prefix-map=`pwd`=/aaaaaaa -o foo $
- ~/gcc/install/bin/gcc foo -flto=auto -ffat-lto-objects -o bar
+ $ echo 'int main(){}' > foo.c
+ $ ~/gcc/install/bin/gcc -c foo.c -O2 -g -flto=auto -ffat-lto-objects -fdebug-prefix-map=`pwd`=/aaaaaaa -o foo
+ $ ~/gcc/install/bin/gcc foo -flto=auto -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.

-- 
You received this bug notification because you are a member of Ubuntu
Foundations Bugs, which is subscribed to gcc-13 in Ubuntu.
https://bugs.launchpad.net/bugs/2019160

Title:
  LTO affecting -fdebug-prefix-map

Status in gcc:
  Unknown
Status in gcc-12 package in Ubuntu:
  New
Status in gcc-13 package in Ubuntu:
  New

Bug description:
  In Ubuntu we use -fdebug-prefix-map to remap a package's build
  directory (which contains random stuff) into a predictable path under
  /usr/src.  This is done 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
  directory.  I can replicate the issue locally, and at first I thought
  this was either upstream bugs #108464 or #87726, but after some
  digging I'm convinced it's something else.  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=auto -ffat-lto-objects -fdebug-prefix-map=`pwd`=/aaaaaaa -o foo
  $ ~/gcc/install/bin/gcc foo -flto=auto -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.

To manage notifications about this bug go to:
https://bugs.launchpad.net/gcc/+bug/2019160/+subscriptions




More information about the foundations-bugs mailing list