]> git.ipfire.org Git - thirdparty/ccache.git/commit
Improve handling of profiling options
authorJoel Rosdahl <joel@rosdahl.net>
Thu, 30 Apr 2020 06:29:31 +0000 (08:29 +0200)
committerJoel Rosdahl <joel@rosdahl.net>
Fri, 1 May 2020 12:44:47 +0000 (14:44 +0200)
commitc9fdcef576dd13a2ea2355bcd866b5c561cb1562
treebe0c61bcd81d8cb51592e2c67582e95079ee10c7
parent934c2cf4bda18fc13fcb583019d82fe7f52331ac
Improve handling of profiling options

Handling of -fprofile-{generate,use}[=path] was implemented in PR #2
(2011). ccache has since then gained support for Clang, which is not
GCC-compatible for -fprofile-{generate,use}[=path]. Furthermore, GCC 9
changed the semantics of -fprofile-{generate,use}=path, making it
incompatible with ccache’s original implementation.

One crucial problem with the implementation is that there is no error
handling when the expected profiling data file cannot be found. This
means that there will be false positives cache hits for Clang and GCC
9+.

Fix this by:

* Checking for different profiling data file locations to handle
  different compilers and versions.
* Bailing out if no profiling data file can be found.

Also:

* Implemented support for Clang’s -fprofile-instr-{generate,use}[=path]
  options.
* Implemented support for -fauto-profile[=path].
* Removed the conversion of absolute path to the profile directory.
  91a2954e says that the directory is rewritten to increase the hit
  rate, but I don’t understand how that could be the case.
* Added tests for the profiling options. Exception:
  -fauto-profile[=path], since that would require running the perf tool.

Fixes #582.
src/ccache.c
src/compopt.c
test/run
test/suites/profiling.bash [new file with mode: 0644]
test/suites/profiling_clang.bash [new file with mode: 0644]
test/suites/profiling_gcc.bash [new file with mode: 0644]
unittest/test_argument_processing.c