[ccache] Why not cache link commands?

Andrew Stubbs ams at codesourcery.com
Tue Sep 18 09:27:21 MDT 2012

On 18/09/12 15:31, Justin Lebar wrote:
>> So, again, before I waste my time implementing this feature, are there any
>> other fundamental gotchas that would prevent it ever working or ever being
>> useful?
> On a large project with many inputs to ld, you'd have to hash a /lot/
> of object files, increasing the overhead of ccache substantially.  I
> understand that this isn't your particular use-case, but it's the
> common one.

Yes, that's true, but those are also the most expensive link commands, 
so maybe it's not so bad.

I realise that there's some risk that a cache miss can be expensive, and 
that a cache hit might be only a very little cheaper than the real link, 
but I'm prepared to take that risk. What I'm looking for is more 
concrete roadblocks I haven't considered.

Incidentally, I'm also considering the possibility of caching the hashes 
and using the inode/size/mtime etc. to short-cut that process (perhaps 
as a "sloppiness" option), not only for objects, but also for sources.

> If you're on Linux, have you tried the gold linker?

Let's limit this discussion to what can be done with ccache, please. I 
assure you, we know about the toolchain options.


More information about the ccache mailing list