diff -urN ccache-3.2.1.orig/ccache.c ccache-3.2.1.skip/ccache.c --- ccache-3.2.1.orig/ccache.c 2014-12-10 22:40:54.000000000 +0300 +++ ccache-3.2.1.skip/ccache.c 2015-03-18 22:35:19.909384846 +0300 @@ -1210,7 +1210,7 @@ * otherwise NULL. Caller frees. */ static struct file_hash * -calculate_object_hash(struct args *args, struct mdfour *hash, int direct_mode) +calculate_object_hash(struct args *args, struct args *preprocessor_args, struct mdfour *hash, int direct_mode) { int i; char *manifest_name; @@ -1422,7 +1422,7 @@ cc_log("Did not find object file hash in manifest"); } } else { - object_hash = get_object_name_from_cpp(args, hash); + object_hash = get_object_name_from_cpp(preprocessor_args, hash); cc_log("Got object file hash from preprocessor"); if (generating_dependencies) { cc_log("Preprocessor created %s", output_dep); @@ -1618,7 +1618,7 @@ */ bool cc_process_args(struct args *args, struct args **preprocessor_args, - struct args **compiler_args) + struct args **compiler_args, struct args **hashable_args) { int i; bool found_c_opt = false; @@ -1635,7 +1635,7 @@ bool dependency_filename_specified = false; /* is the dependency makefile target name specified with -MT or -MQ? */ bool dependency_target_specified = false; - struct args *expanded_args, *stripped_args, *dep_args, *cpp_args; + struct args *expanded_args, *stripped_args, *dep_args, *cpp_args, *nonhash_args; int argc; char **argv; bool result = true; @@ -1645,6 +1645,7 @@ stripped_args = args_init(0, NULL); dep_args = args_init(0, NULL); cpp_args = args_init(0, NULL); + nonhash_args = args_init(0, NULL); argc = expanded_args->argc; argv = expanded_args->argv; @@ -1660,7 +1661,7 @@ result = false; goto out; } - args_add(stripped_args, argv[i]); + args_add(nonhash_args, argv[i]); continue; } @@ -2388,11 +2389,18 @@ *preprocessor_args = args_copy(stripped_args); args_extend(*preprocessor_args, cpp_args); + *hashable_args = args_copy(*preprocessor_args); + + /* Append args which we don't want to be hashed */ + args_extend(*compiler_args, nonhash_args); + args_extend(*preprocessor_args, nonhash_args); + out: args_free(expanded_args); args_free(stripped_args); args_free(dep_args); args_free(cpp_args); + args_free(nonhash_args); return result; } @@ -2587,6 +2595,9 @@ struct mdfour direct_hash; struct mdfour cpp_hash; + /* Arguments (except marked with --ccache-skip) to add to hash */ + struct args *hash_args; + /* Arguments (except -E) to send to the preprocessor. */ struct args *preprocessor_args; @@ -2628,7 +2639,7 @@ conf->direct_mode = false; } - if (!cc_process_args(orig_args, &preprocessor_args, &compiler_args)) { + if (!cc_process_args(orig_args, &preprocessor_args, &compiler_args, &hash_args)) { failed(); } @@ -2642,13 +2653,13 @@ cc_log("Object file: %s", output_obj); hash_start(&common_hash); - calculate_common_hash(preprocessor_args, &common_hash); + calculate_common_hash(hash_args, &common_hash); /* try to find the hash using the manifest */ direct_hash = common_hash; if (conf->direct_mode) { cc_log("Trying direct lookup"); - object_hash = calculate_object_hash(preprocessor_args, &direct_hash, 1); + object_hash = calculate_object_hash(hash_args, preprocessor_args, &direct_hash, 1); if (object_hash) { update_cached_result_globals(object_hash); @@ -2682,7 +2693,7 @@ * included_files. */ cpp_hash = common_hash; - object_hash = calculate_object_hash(preprocessor_args, &cpp_hash, 0); + object_hash = calculate_object_hash(hash_args, preprocessor_args, &cpp_hash, 0); if (!object_hash) { fatal("internal error: object hash from cpp returned NULL"); } diff -urN ccache-3.2.1.orig/ccache.h ccache-3.2.1.skip/ccache.h --- ccache-3.2.1.orig/ccache.h 2014-12-10 22:40:54.000000000 +0300 +++ ccache-3.2.1.skip/ccache.h 2015-03-18 15:40:12.000000000 +0300 @@ -224,7 +224,7 @@ extern time_t time_of_compilation; bool cc_process_args(struct args *args, struct args **preprocessor_args, - struct args **compiler_args); + struct args **compiler_args, struct args **hashable_args); void cc_reset(void); bool is_precompiled_header(const char *path); Binary files ccache-3.2.1.orig/zlib/libz.a and ccache-3.2.1.skip/zlib/libz.a differ