On 4/12/20 7:27 AM, John Selbie via Cygwin wrote: > TLDR: With gcc/g++ 9.2.0 and 9.30 on Cygwin, when you use > -fprofile-generate and -fprofile-dir together, the target path for the > .gcda file is corrupted with a backslash instead of having a forward slash > used. > > Here's a sample run where profile guided optimization is getting enabled > for a simple little C++ program: > > jselbie@IRONMAIDEN ~/bench > $ g++ bench.cpp -o bench -fprofile-generate > -fprofile-dir=/home/jselbie/bench/profile -O3 > > jselbie@IRONMAIDEN ~/bench > $ ./bench.exe > > profiling:/home/jselbie/bench/profile/#home#jselbie#bench\bench.gcda:Skip > > That "profiling...Skip" line is an error indicating that the profiling > library can't save the gcda file. If you look closely,there's backslash > between the encoded path and the filename (bench.gcda). > > Doing a strings search on the binary reveals the same thing: > > jselbie@IRONMAIDEN ~/bench > $ strings bench.exe | grep jselbie > /home/jselbie/bench/profile/#home#jselbie#bench\bench.gcda > > If I switch back to Linux and do the same steps, it not only works, but you > can see there is no backslash embedded into the binary either > > jselbie@IRONMAIDEN:~/bench$ g++ bench.cpp -o bench -fprofile-generate > -fprofile-dir=/home/jselbie/bench/profile -O3 > > jselbie@IRONMAIDEN:~/bench$ ./bench > > jselbie@IRONMAIDEN:~/bench$ ls profile/ > bench.gcda > > jselbie@IRONMAIDEN:~/bench$ strings bench | grep jselbie > /home/jselbie/bench/profile/bench.gcda > > > The workaround is to just skip the -fprofile-dir flag altogether. > > Seems like there is a bug in Cygwin's build of gcc/g++ that puts the wrong > path separator into the executable > > Can this be fixed? Or a place where I can file a bug? >
Try filing the issue on https://gcc.gnu.org/bugzilla/, include a minimal test case that shows the problem, thanks.
signature.asc
Description: OpenPGP digital signature
-- Problem reports: https://cygwin.com/problems.html FAQ: https://cygwin.com/faq/ Documentation: https://cygwin.com/docs.html Unsubscribe info: https://cygwin.com/ml/#unsubscribe-simple