]> git.ipfire.org Git - thirdparty/ccache.git/commitdiff
Merge branch '3.1-maint' into 3.2-maint
authorJoel Rosdahl <joel@rosdahl.net>
Tue, 12 Jul 2016 19:14:01 +0000 (21:14 +0200)
committerJoel Rosdahl <joel@rosdahl.net>
Tue, 12 Jul 2016 19:14:01 +0000 (21:14 +0200)
* 3.1-maint:
  Prepare for v3.1.12
  Disable mingw32 build on v3.1.x
  Add .travis.yml
  Mark 3.1.12 as still unreleased
  Prepare for v3.1.12
  Don't rewrite source file path if it's absolute and a symlink

1  2 
NEWS.txt
ccache.c
test.sh

diff --cc NEWS.txt
index 7d34701e1cf7a85fad6862e9126d7b2c6d6f6165,62cbaa3262aa32f0e3b134741e07ea59b4810ad3..bc846aac2a0cd4d04ca662119bb8581001ebf893
+++ b/NEWS.txt
@@@ -2,294 -2,19 +2,311 @@@ ccache new
  ===========
  
  
 +Unreleased 3.2.6
 +----------------
 +
 +Bug fixes
 +~~~~~~~~~
 +
 +- Fixed build problem on QNX, which lacks ``SA_RESTART''.
 +
 +- Bail out on compiler option `-fstack-usage` since it creates a `.su` file
 +  which ccache currently doesn't handle.
 +
 +- ccache now knows how to work around a glitch in the output of GCC 6's
 +  preprocessor.
 +
++- Fixed a bug where (due to ccache rewriting paths) the compiler could choose
++  incorrect include files if `CCACHE_BASEDIR` is used and the source file path
++  is absolute and is a symlink.
++
 +
 +ccache 3.2.5
 +------------
 +Release date: 2016-04-17
 +
 +New features and improvements
 +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 +
 +- Only pass clang-specific `-stdlib=` to the preprocessor.
 +
 +- Improved handling of stale NFS handles.
 +
 +- Made it harder to misinterpret documentation of boolean environment settings'
 +  semantics.
 +
 +
 +Bug fixes
 +~~~~~~~~~
 +
 +- Include m4 files used by configure.ac in the source dist archives.
 +
 +- Corrected "Performance" section in the manual regarding `__DATE_`, `__TIME__`
 +  and `__FILE__` macros.
 +
 +- Fixed build on Solaris 10+ and AIX 7.
 +
 +- Fixed failure to create directories on QNX.
 +
 +- Don't (try to) update manifest file in ``read-only'' and ``read-only direct''
 +  modes.
 +
 +- Fixed a bug in caching of `stat` system calls in ``file_stat_matches
 +  sloppiness mode''.
 +
 +- Fixed bug in hashing of clang plugins, leading to unnecessary cache misses.
 +
 +- Fixed --print-config to show ``pch_defines sloppiness''.
 +
 +- The man page is now built when running ``make install'' from Git repository
 +  sources.
 +
 +
 +ccache 3.2.4
 +------------
 +Release date: 2015-10-08
 +
 +
 +Bug fixes
 +~~~~~~~~~
 +
 +- Fixed build error related to zlib on systems with older make versions
 +  (regression in ccache 3.2.3).
 +
 +- Made conversion-to-bool explicit to avoid build warnings (and potential
 +  runtime errors) on legacy systems.
 +
 +- Improved signal handling: Kill compiler on SIGTERM; wait for compiler to exit
 +  before exiting; die appropriately.
 +
 +- Minor fixes related to Windows support.
 +
 +- The correct compression level is now used if compression is requested.
 +
 +- Fixed a bug where cache cleanup could be run too early for caches larger than
 +  64 GiB on 32-bit systems.
 +
 +
 +ccache 3.2.3
 +------------
 +Release date: 2015-08-16
 +
 +
 +New features and improvements
 +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 +
 +- Added support for compiler option `-gsplit-dwarf`.
 +
 +
 +Bug fixes
 +~~~~~~~~~
 +
 +- Support external zlib in nonstandard directory.
 +
 +- Avoid calling `exit()` inside an exit handler.
 +
 +- Let exit handler terminate properly.
 +
 +- Bail out on compiler option `--save-temps` in addition to `-save-temps`.
 +
 +- Only log "Disabling direct mode" once when failing to read potential include
 +  files.
 +
 +
 +ccache 3.2.2
 +------------
 +Release date: 2015-05-10
 +
 +
 +New features and improvements
 +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 +
 +- Added support for `CCACHE_COMPILERCHECK=string:<value>`. This is a faster
 +  alternative to `CCACHE_COMPILERCHECK=<command>` if the command's output can
 +  be precalculated by the build system.
 +
 +- Add support for caching code coverage results (compiling for gcov).
 +
 +
 +Bug fixes
 +~~~~~~~~~
 +
 +- Made hash of cached result created with and without `CCACHE_CPP2` different.
 +  This makes it possible to rebuild with `CCACHE_CPP2` set without having to
 +  clear the cache to get new results.
 +
 +- Don't try to reset a non-existing stats file. This avoids ``No such file or
 +  directory'' messages in the ccache log when the cache directory doesn't
 +  exist.
 +
 +- Fixed a bug where ccache deleted clang diagnostics after compiler failures.
 +
 +- Avoid performing an unnecessary copy of the object file on a cache miss.
 +
 +- Bail out on too hard compiler option `-fmodules`.
 +
 +- Bail out on too hard compiler option `-fplugin=libcc1plugin` (interaction
 +  with GDB).
 +
 +- Fixed build error when compiling ccache with recent clang versions.
 +
 +- Removed signal-unsafe code from signal handler.
 +
 +- Corrected logic for when to output cached stderr.
 +
 +- Wipe the whole cached result on failure retrieving a cached file.
 +
 +- Fixed build error when compiling ccache with recent clang versions.
 +
 +
 +ccache 3.2.1
 +------------
 +Release date: 2014-12-10
 +
 +
 +Bug fixes
 +~~~~~~~~~
 +
 +- Fixed regression in temporary file handling, which lead to incorrect
 +  permissions for stats, manifest and ccache.conf files in the cache.
 +
 +- `CACHEDIR.TAG` files are now created in the [0-9a-f] subdirectories so that
 +  ccache.conf is not lost in backups.
 +
 +- Made the default cache size suffix `G`, as previously documented.
 +
 +- `-fdiagnostics-color=auto` is now passed to the compiler even if stderr is
 +  redirected. This fixes a problem when, for instance, a configure test probes
 +  if the compiler (wrapped via ccache) supports `-fdiagnostics-color=auto`.
 +
 +- Added missing documentation for `max_files` and `max_size` configuration
 +  options.
 +
 +
 +ccache 3.2
 +----------
 +Release date: 2014-11-17
 +
 +
 +New features and improvements
 +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 +
 +- Added support for configuring ccache via one or several configuration files
 +  instead of via environment variables. Environment variables still have
 +  priority but are no longer the recommended way of customizing ccache
 +  behavior. See the manual for more information.
 +
 +- Added support for compiler error/warning messages with color.
 +
 +- Made creation of temporary directories and cache directories smarter to avoid
 +  unnecessary `stat` calls.
 +
 +- Improved efficiency of the algorithm that scans for `__DATE_` and `__TIME__`
 +  tokens in the hashed source code.
 +
 +- Added support for several binaries (separated by space) in `CCACHE_PREFIX`.
 +
 +- The `-c` option is no longer passed to the preprocessor. This fixes problems
 +  with clang and Solaris's C++ compiler.
 +
 +- ccache no longer passes preprocessor options like `-D` and `-I` to the
 +  compiler when compiling preprocessed output. This fixes warnings emitted by
 +  clang.
 +
 +- Compiler options `-fprofile-generate`, `-fprofile-arcs`, `-fprofile-use` and
 +  `-fbranch-probabilities` are now handled without bailing.
 +
 +- Added support for clang's `--serialize-diagnostic` option, storing the
 +  diagnostic file (`.dia`) in the cache.
 +
 +- Added support for precompiled headers when using clang.
 +
 +- Added support for clang `.pth` (pretokenized header) files.
 +
 +- Changed the `-x` language option to use the new objective C standard for GCC
 +  and clang.
 +
 +- On a cache miss, ccache now instructs the compiler to create the object file
 +  at the real destination and then copies the file into the cache instead of
 +  the other way around. This is needed to support compiler options like
 +  `-fprofile-arcs` and `--serialize-diagnostics`.
 +
 +- ccache now checks that included files' ctimes aren't too new. This check can
 +  be turned off by adding `include_file_ctime` to the ``ccache sloppiness''
 +  setting.
 +
 +- Added possibility to get cache hits based on filename, size, mtime and ctime
 +  only. On other words, source code files are not even read, only stat-ed. This
 +  operation mode is opt-in by adding `file_stat_matches` to the ``ccache
 +  sloppiness'' setting.
 +
 +- The filename part of options like `-Wp,-MDfilename` is no longer included in
 +  the hash since the filename doesn't have any bearing on the result.
 +
 +- Added a ``read-only direct'' configuration setting, which is like the
 +  ordinary read-only setting except that ccache will only try to retrieve
 +  results from the cache using the direct mode, not the preprocessor mode.
 +
 +- The display and interpretation of cache size has been changed to use SI
 +  units.
 +
 +- Default cache size is now 5 GB (was previously 1 GiB).
 +
 +- Added configuration option to set the compression level of compressed object
 +  files in the cache.
 +
 +- Added support for `@file` and `-@file` arguments (reading options from a
 +  file).
 +
 +- `-Wl,` options are no longer included in the hash since they don't affect
 +  compilation.
 +
 +- Bail out on too hard compiler option `-Wp,-P`.
 +
 +- Optimized MD4 calculation code on little-endian systems.
 +
 +- Various improvements and fixes on win32.
 +
 +- Improved logging to the ccache log file.
 +
 +- Added `--dump-manifest` command-line option for debugging purposes.
 +
 +- Added `--with-bundled-zlib` configure option.
 +
 +- Upgraded bundled zlib to version 1.2.8.
 +
 +- Improved `dev.mk` to be more platform independent.
 +
 +- Made the test suite work with clang and gcc-llvm on OS X.
 +
 +- Various other improvements of the test suite.
 +
 +
 +Bug fixes
 +~~~~~~~~~
 +
 +- Any previous `.stderr` is now removed from the cache when recaching.
 +
 +- Fixed an issue when handling the `-arch` compiler option with an argument.
 +
 +- Fixed race condition when creating the initial cache directory.
 +
 +- Fixed test suite failures when `CC` is a ccache-wrapped compiler.
 +
 +
+ ccache 3.1.12
+ -------------
+ Release date: 2016-07-12
+ Bug fixes
+ ~~~~~~~~~
+ - Fixed a bug where (due to ccache rewriting paths) the compiler could choose
+   incorrect include files if `CCACHE_BASEDIR` is used and the source file path
+   is absolute and is a symlink.
  ccache 3.1.11
  -------------
  Release date: 2015-03-07
diff --cc ccache.c
index 02beab0e5397af696d77012d52b81a8716d3b0c2,ff0eb0dfdb30c1fa30b918b2fbea64bade4d3d22..014c5a0d7886984f58d39d6639ba8ca797bc13f2
+++ b/ccache.c
@@@ -2508,22 -1747,17 +2508,31 @@@ cc_process_args(struct args *args, stru
                        goto out;
                }
  
-               /* Rewrite to relative to increase hit rate. */
-               input_file = make_relative_path(x_strdup(argv[i]));
 +              /* The source code file path gets put into the notes */
 +              if (generating_coverage) {
 +                      input_file = x_strdup(argv[i]);
 +                      continue;
 +              }
 +
+               lstat(argv[i], &st);
+               if (S_ISLNK(st.st_mode)) {
+                       /* Don't rewrite source file path if it's a symlink since
+                          make_relative_path resolves symlinks using realpath(3) and this leads
+                          to potentially choosing incorrect relative header files. See the
+                          "symlink to source file" test. */
+                       input_file = x_strdup(argv[i]);
+               } else {
+                       /* Rewrite to relative to increase hit rate. */
+                       input_file = make_relative_path(x_strdup(argv[i]));
+               }
 +      } /* for */
 +
 +      if (found_S_opt) {
 +              /* Even if -gsplit-dwarf is given, the .dwo file is not generated when -S
 +               * is also given.
 +               */
 +              using_split_dwarf = false;
 +              cc_log("Disabling caching of dwarf files since -S is used");
        }
  
        if (!input_file) {
diff --cc test.sh
index 1090649b28fa4329e7b74be644566ac43c6b5d84,490e975762f7851eeac3b4048ca611034abfa589..27895a9a5c2b07731bb20a3e5fa495f7e6a4189a
+++ b/test.sh
@@@ -2366,51 -1835,61 +2366,104 @@@ clang_pch_suite() 
      checkstat 'cache hit (direct)' 0
      checkstat 'cache hit (preprocessed)' 2
      checkstat 'cache miss' 2
 +
 +    rm pch.h.pth
 +}
 +
 +upgrade_suite() {
 +    testname="keep maxfiles and maxsize settings"
 +    rm -rf $CCACHE_DIR $CCACHE_CONFIGPATH
 +    mkdir -p $CCACHE_DIR/0
 +    echo "0 0 0 0 0 0 0 0 0 0 0 0 0 2000 131072" >$CCACHE_DIR/0/stats
 +    checkstat 'max files' 32000
 +    checkstat 'max cache size' '2.1 GB'
 +}
 +
 +prefix_suite() {
 +    testname="prefix"
 +    $CCACHE -Cz >/dev/null
 +    rm -f prefix.result
 +    cat <<'EOF' >prefix-a
 +#!/bin/sh
 +echo a >>prefix.result
 +exec "$@"
 +EOF
 +    cat <<'EOF' >prefix-b
 +#!/bin/sh
 +echo b >>prefix.result
 +exec "$@"
 +EOF
 +    chmod +x prefix-a prefix-b
 +    cat <<'EOF' >file.c
 +int foo;
 +EOF
 +    PATH=.:$PATH CCACHE_PREFIX="prefix-a prefix-b" $CCACHE $COMPILER -c file.c
 +    checkstat 'cache hit (direct)' 0
 +    checkstat 'cache hit (preprocessed)' 0
 +    checkstat 'cache miss' 1
 +    checkfile prefix.result "a
 +b"
 +    PATH=.:$PATH CCACHE_PREFIX="prefix-a prefix-b" $CCACHE $COMPILER -c file.c
 +    checkstat 'cache hit (direct)' 0
 +    checkstat 'cache hit (preprocessed)' 1
 +    checkstat 'cache miss' 1
 +    checkfile prefix.result "a
 +b"
  }
  
+ symlinks_suite() {
+     ##################################################################
+     testname="symlink to source directory"
+     mkdir dir
+     cd dir
+     mkdir -p d1/d2
+     echo '#define A "OK"' >d1/h.h
+     cat <<EOF >d1/d2/c.c
+ #include <stdio.h>
+ #include "../h.h"
+ int main() { printf("%s\n", A); }
+ EOF
+     echo '#define A "BUG"' >h.h
+     ln -s d1/d2 d3
+     CCACHE_BASEDIR=/ $CCACHE $COMPILER -c $PWD/d3/c.c
+     $COMPILER -c $PWD/d3/c.c
+     $COMPILER c.o -o c
+     result=$(./c)
+     if [ "$result" != OK ]; then
+         test_failed "Incorrect header file used"
+     fi
+     cd ..
+     rm -rf dir
+     ##################################################################
+     testname="symlink to source file"
+     mkdir dir
+     cd dir
+     mkdir d
+     echo '#define A "BUG"' >d/h.h
+     cat <<EOF >d/c.c
+ #include <stdio.h>
+ #include "h.h"
+ int main() { printf("%s\n", A); }
+ EOF
+     echo '#define A "OK"' >h.h
+     ln -s d/c.c c.c
+     CCACHE_BASEDIR=/ $CCACHE $COMPILER -c $PWD/c.c
+     $COMPILER c.o -o c
+     result=$(./c)
+     if [ "$result" != OK ]; then
+         test_failed "Incorrect header file used"
+     fi
+     cd ..
+     rm -rf dir
+ }
  ######################################################################
  # main program
  
@@@ -2521,10 -1938,10 +2574,11 @@@ readonly_direc
  extrafiles
  cleanup
  pch
+ symlinks
 +upgrade
 +prefix
  "
  
 -host_os="`uname -s`"
  case $host_os in
      *MINGW*|*mingw*)
          export CCACHE_DETECT_SHEBANG