[ccache] Support for -fprofile-generate, -fprofile-use, -fprofile-arcs

Joel Rosdahl joel at rosdahl.net
Fri Jul 22 11:49:21 MDT 2011


On 2011-07-21 20:22, Chris AtLee wrote:
> I recently did some work to get ccache to support gcc's various
> -fprofile-* options. In some local testing in works great.

Thanks!

> I've got the code up on github right now:
> https://github.com/catlee/ccache/compare/jrosdahl:master...catlee:profile
> 
> Does this approach look like it will work?

Justin Lebar's point that the cwd probably needs to be hashed seems
valid. Other than that, I think it looks generally fine, but I only have
limited knowledge about the -fprofile-* options so I can't say I
understand their interaction completely. Some comments and questions,
though:

I think that the "output_to_real_object_first mode" should really be the
default and only mode. That would of course mean that the things in
from_cache() that need to be done after storing an object in the cache
should be refactored out somehow, but we can do that later.

What about the -fprofile-generate=path and -fprofile-use=path forms?
Should those be detected as well?

tmp_obj is freed at the end of to_cache(), so output_obj will refer to
freed memory when dereferenced in from_cache() later. An x_strdup is needed.

//-style comments won't compile on systems with C89 compilers, so use
/**/ instead.

You should probably use hash_delimiter(hash, "-fprofile-use") or so
before hashing the gcda file (and then I guess that the hashing of "no
data" won't be necessary).

-- Joel


More information about the ccache mailing list