[ccache] Using ccache with -fprofile-generate/-fprofile-use

Phil Endecott phil_adykr_endecott at chezphil.org
Wed Aug 29 17:58:29 GMT 2007


Dear ccache people,

Has anyone ever used ccache with gcc's profile-driven-optimisation?  I 
have tried, and hit pathname-related problems.

Profile driven optimisation is supposed to work like this: you compile 
with -fprofile-generate and run your program; on termination it saves a 
load of .gcda files, one for each object file.  You then compile again 
with -fprofile-use; it reads the .gcda files and optimises based on 
their contents.  I have this working with CCACHE_DISABLE set.

But when using ccache, when the instrumented program terminates it 
attempts to write a series of files with names like
/home/phil/.ccache/tmp.hash.egypt.28177.gcda
/home/phil/.ccache/tmp.hash.egypt.28198.gcda

Presumably the code that -fprofile-generate inserted only knows the 
object file name of the cache file, and tries to put its .gcda file 
alongside it.  Presumably when I recompile with -fprofile-use it will 
fail to find these files because the new compilation will have a new 
cache filename.  (I only say "presumably" because it actually doesn't 
get as far as that due to a permissions issue in my case.)

This looks like a pretty fundamental problem.  Any ideas about how to 
fix it?


Regards,

Phil.

P.S.  Please Cc: me in any replies.






More information about the ccache mailing list