[ccache] Why not cache link commands?

Andrew Stubbs ams at codesourcery.com
Tue Sep 18 06:44:29 MDT 2012


Hi all, again,

I've just posted about improving compile speed by caching compiler 
failures, and in the same vein I'd like to consider caching 
called-for-link compile tasks.

This is partly interesting for the many small autoconf tests, but is 
also increasingly interesting for real compilations, now that 
whole-program-optimization and link-time-optimization is more available 
in GCC. Even without all this link-time compilation activity, there are 
some link operations that simply take forever, mostly due to large file 
sizes.

Clearly there are some technical challenges in doing this: we'd have to 
hash all the object files and libraries (a la direct mode), but those 
problems are surmountable, I think. The linker does not use any 
libraries not listed with "gcc '-###' whatever".

I'm also aware that it's not that interesting for many incremental 
builds, where the final link will always be different, but my use case 
is accelerating rebuilds of projects that my have many outputs, most of 
which are likely to be unaffected by small code changes. It's also worth 
noting that incremental builds are not the target use case for ccache in 
general.

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?

Has anybody else ever tried to do this? Is anybody trying to do it now?

Thanks

Andrew


More information about the ccache mailing list