LTO affecting -fdebug-prefix-map
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
gcc |
In Progress
|
Medium
|
|||
gcc-12 (Ubuntu) |
Confirmed
|
High
|
Unassigned | ||
gcc-13 (Ubuntu) |
Confirmed
|
High
|
Unassigned |
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:
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 (608e7f3ab47fe7
A simple reproducer for the problem follows:
$ echo 'int main(){}' > foo.c
$ ~/gcc/install/
$ ~/gcc/install/
A workaround for this bug is to either stop using LTO or explicitly set -fdebug-prefix-map when linking the object.
Changed in gcc: | |
importance: | Unknown → Medium |
status: | Unknown → New |
Changed in gcc: | |
status: | New → In Progress |
Hi,
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:/ /launchpadlibra rian.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 (608e7f3ab47fe7 46279c552c35741 47aa3d8ee76) , 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.