Description of problem: With the update to gcc 13, ccache's test suite is failing complaining that debug-prefix-map is failing. I reported it upstream to ccache (https://github.com/ccache/ccache/issues/1242#issuecomment-1386036279), and they responded: This looks like a bug in GCC or binutils in Fedora Rawhide since -fdebug-prefix-map=FROM=TO does not work: $ gcc --version | head -n 1 gcc (GCC) 13.0.0 20230115 (Red Hat 13.0.0-0) $ as --version | head -n 1 GNU assembler version 2.39-6.fc38 $ touch test.c $ gcc -g -fdebug-prefix-map=$PWD=XXX -c $PWD/test.c $ grep -c $PWD test.o 2 $ grep -c XXX test.o 0 Compare with this: $ gcc --version | head -n 1 gcc (Ubuntu 11.3.0-1ubuntu1~22.04) 11.3.0 $ as --version | head -n 1 GNU assembler (GNU Binutils for Ubuntu) 2.38 $ touch test.c $ gcc -g -fdebug-prefix-map=$PWD=XXX -c $PWD/test.c $ grep -c $PWD test.o 0 $ grep -c XXX test.o 2 Of course, I can't reproduce those results on my Fedora rawhide VM, but the test still fails so I think something is up. Version-Release number of selected component (if applicable): gcc-13.0.0-0.9.fc38.x86_64
Can't reproduce. For empty test.c there isn't much debug info produced, but still I see Contents of section .debug_str: 0000 474e5520 43313720 31332e30 2e302032 GNU C17 13.0.0 2 0010 30323330 31313520 28526564 20486174 0230115 (Red Hat 0020 2031332e 302e302d 3029202d 6d736563 13.0.0-0) -msec 0030 7572652d 706c7420 2d6d7475 6e653d70 ure-plt -mtune=p 0040 6f776572 38202d6d 6370753d 706f7765 ower8 -mcpu=powe 0050 7238202d 67005858 582f7465 73742e63 r8 -g.XXX/test.c 0060 00 . When I try something non-empty: int main () { return 0; } I get: readelf -wi a.o | grep 'tmp\|XXX' <12> DW_AT_name : (indirect string, offset: 0x0): XXX/a.c <16> DW_AT_comp_dir : XXX
Oh, and readelf -wl a.o | grep 'tmp\|XXX' 1 XXX
Created attachment 1939079 [details] Reproducer spec file Okay, I think I've finally created a reproducer based on the actual test ccache runs. It also shows a situation in which debug-prefix-map works and fails. On rawhide I get: + cd debug-prefix-map-test-1.0.0 + for dir in run.real run.real/dir1 + mkdir -p run.real/include run.real/src + rm -f run + ln -s run.real run + cd run + cat + cat + CCACHE_DISABLE=1 + CCACHE_COMPILER= + CCACHE_PREFIX= + /usr/bin/gcc -g -fdebug-prefix-map=/home/orion/debug-prefix-map-test/debug-prefix-map-test-1.0.0/run=some_name_not_likely_to_exist_in_path -Iinclude -c -fdiagnostics-color -o ./test.o src/test.c + readelf -wi test.o + grep -E '/home/orion/debug-prefix-map-test/debug-prefix-map-test-1.0.0/run|some_name_not_likely_to_exist_in_path' <12> DW_AT_name : (indirect line string, offset: 0x2b): some_name_not_likely_to_exist_in_path.real/src/test.c <16> DW_AT_comp_dir : (indirect line string, offset: 0x0): some_name_not_likely_to_exist_in_path.real + readelf -wl test.o + grep -E '/home/orion/debug-prefix-map-test/debug-prefix-map-test-1.0.0/run|some_name_not_likely_to_exist_in_path' 0 (indirect line string, offset: 0x61): some_name_not_likely_to_exist_in_path.real 1 (indirect line string, offset: 0x8c): some_name_not_likely_to_exist_in_path.real/src 2 (indirect line string, offset: 0xbb): some_name_not_likely_to_exist_in_path.real/include + cd - /home/orion/debug-prefix-map-test/debug-prefix-map-test-1.0.0 + for dir in run.real run.real/dir1 + mkdir -p run.real/dir1/include run.real/dir1/src + rm -f run + ln -s run.real run + cd run/dir1 + cat + cat + CCACHE_DISABLE=1 + CCACHE_COMPILER= + CCACHE_PREFIX= + /usr/bin/gcc -g -fdebug-prefix-map=/home/orion/debug-prefix-map-test/debug-prefix-map-test-1.0.0/run/dir1=some_name_not_likely_to_exist_in_path -Iinclude -c -fdiagnostics-color -o ./test.o src/test.c + readelf -wi test.o + grep -E '/home/orion/debug-prefix-map-test/debug-prefix-map-test-1.0.0/run/dir1|some_name_not_likely_to_exist_in_path' <16> DW_AT_comp_dir : (indirect line string, offset: 0xb): /home/orion/debug-prefix-map-test/debug-prefix-map-test-1.0.0/run/dir1 + readelf -wl test.o + grep -E '/home/orion/debug-prefix-map-test/debug-prefix-map-test-1.0.0/run/dir1|some_name_not_likely_to_exist_in_path' 0 (indirect line string, offset: 0x52): /home/orion/debug-prefix-map-test/debug-prefix-map-test-1.0.0/run/dir1 + cd - /home/orion/debug-prefix-map-test/debug-prefix-map-test-1.0.0 + exit 1 So in the directory directly under the symlink the mapping works. But when in a subdirectory of it it does not. On F37: + cd debug-prefix-map-test-1.0.0 + for dir in run.real run.real/dir1 + mkdir -p run.real/include run.real/src + rm -f run + ln -s run.real run + cd run + cat + cat + CCACHE_DISABLE=1 + CCACHE_COMPILER= + CCACHE_PREFIX= + /usr/bin/gcc -g -fdebug-prefix-map=/builddir/build/BUILD/debug-prefix-map-test-1.0.0/run=some_name_not_likely_to_exist_in_path -Iinclude -c -fdiagnostics-color -o ./test.o src/test.c + readelf -wi test.o + grep -E '/builddir/build/BUILD/debug-prefix-map-test-1.0.0/run|some_name_not_likely_to_exist_in_path' <16> DW_AT_comp_dir : (indirect line string, offset: 0x0): some_name_not_likely_to_exist_in_path + readelf -wl test.o + grep -E '/builddir/build/BUILD/debug-prefix-map-test-1.0.0/run|some_name_not_likely_to_exist_in_path' 0 (indirect line string, offset: 0x31): some_name_not_likely_to_exist_in_path /builddir/build/BUILD/debug-prefix-map-test-1.0.0 + cd - + for dir in run.real run.real/dir1 + mkdir -p run.real/dir1/include run.real/dir1/src + rm -f run + ln -s run.real run + cd run/dir1 + cat + cat + CCACHE_DISABLE=1 + CCACHE_COMPILER= + CCACHE_PREFIX= + /usr/bin/gcc -g -fdebug-prefix-map=/builddir/build/BUILD/debug-prefix-map-test-1.0.0/run/dir1=some_name_not_likely_to_exist_in_path -Iinclude -c -fdiagnostics-color -o ./test.o src/test.c + readelf -wi test.o + grep -E '/builddir/build/BUILD/debug-prefix-map-test-1.0.0/run/dir1|some_name_not_likely_to_exist_in_path' <16> DW_AT_comp_dir : (indirect line string, offset: 0x0): some_name_not_likely_to_exist_in_path + readelf -wl test.o + grep -E '/builddir/build/BUILD/debug-prefix-map-test-1.0.0/run/dir1|some_name_not_likely_to_exist_in_path' 0 (indirect line string, offset: 0x31): some_name_not_likely_to_exist_in_path + cd - /builddir/build/BUILD/debug-prefix-map-test-1.0.0 + exit 1
This bug appears to have been reported against 'rawhide' during the Fedora Linux 38 development cycle. Changing version to 38.
This appears to be fixed now.