]> git.ipfire.org Git - thirdparty/ccache.git/commit
Allow treating "/dev/null" as an input file (#365)
authordianders <dianders@disordat.com>
Thu, 21 Mar 2019 19:46:34 +0000 (12:46 -0700)
committerJoel Rosdahl <joel@rosdahl.net>
Thu, 21 Mar 2019 19:46:34 +0000 (20:46 +0100)
commit980e032d14bafa8a715576eb6987957702366007
tree4fc9f703ccdd4f6286555c5bcc34691dd97f7db9
parent7abac8f2cd1a0173784a16cfe8113392780323eb
Allow treating "/dev/null" as an input file (#365)

One of the slow things for incremental Linux kernel builds is that
during the single-threaded parsing stage of the Makefile the kernel
calls into the C compiler to test which options the compiler supports.
A lot.  Specifically there are snippets like this all over the
Makefile:

$(call cc-option,-Oz,-Os)

...which translates into a call to the C compiler:

${CC} ... -Oz -c -x c /dev/null -o .178435.tmp

One of the contributing factors to the overall slowness is that the
input file for this test is "/dev/null".  This trips a check in ccache
because "/dev/null" "isn't a plain file".

As far as I understand it it should be totally fine to cache the
result of compiling "/dev/null".  It's basically just compiling an
empty file.

On my setup this improves the parsing stage of the kernel Makefile
from 3.25 seconds to 2.0 seconds (so saves 1.25 seconds for each of
build, install, and modules_install for 3.75 seconds total).
src/ccache.c