What does ccache mean under "call for link"

What is meant by ccache statistics called link. I thought ccache only wrapped the compiler and not the linker?

[Brian@localhost ~]$ ccache -s
cache directory                     /home/Brian/.ccache
cache hit (direct)                 19813
cache hit (preprocessed)              67
cache miss                            11
called for link                      498
called for preprocessing              10
unsupported source language          472
no input file                         12
files in cache                    258568
cache size                          33.8 Gbytes
max cache size                     100.0 Gbytes

      

+3


source to share


2 answers


ccache

doesn't really support binding.



However it replaces the C compiler (rather the C compiler driver) (see where and how it is installed and used). Because of this, it must "skip" any commands it receives and does not process / modify itself in the appropriate parts of the toolchain.

+3


source


The reading of the release notes was also not very clear:

The statistics counter called for a link is now correctly updated when linking to a single object file.

But this means that you are compiling and linking in one operation, so ccache cannot provide a transparent result.

Demo with basic hello.c program. First allow everything:

$ ccache -Czs
Cleared cache
Statistics cleared
cache directory                     /home/jdg/.ccache
cache hit (direct)                     0
cache hit (preprocessed)               0
cache miss                             0
files in cache                         0

      

Compiling and linking in one step (twice to be sure):

$ ccache g++ hello.c
$ ccache g++ hello.c
$ ccache -s
cache hit (direct)                     0
cache hit (preprocessed)               0
cache miss                             0
called for link                        2
files in cache                         0

      

Nothing is cached because ccache just can't



Doing this in two separate steps (also twice):

$ ccache g++ -c hello.c ; g++ hello.o
$ ccache g++ -c hello.c ; g++ hello.o
$ ccache -s
cache hit (direct)                     1
cache hit (preprocessed)               0
cache miss                             1
called for link                        4
no input file                          2
files in cache                         2

      

Now this worked:

  • The first compilation missed the cache and saved the results (two files: manifest plus.o)
  • The second made a trick cache
  • g ++ is called to link 4 times in total, including 2 times without source, but only .o

And a call for pre-processing the material? Simple, you just used your compiler to extend all of the include / define content (e.g. when looking for a dependency).

$ g++ -E hello.c
$ g++ -M hello.c
$ ccache -s
cache hit (direct)                     1
cache hit (preprocessed)               0
cache miss                             1
called for link                        4
called for preprocessing               2
unsupported compiler option            1
no input file                          2
files in cache                         2

      

Hope this helps!

+2


source







All Articles