Hi, During testing and using a locally modified version of ccache to support "-gsplit-dwarf" (see bug 10005 ) I noticed that the popular compiler flag to pass parameters to linker -Wl,... (... is a string that denotes the parameters to the linker) is not ignored for computing hash and thus the sequence of commands, ccache gcc -c /tmp/t.c ccache gcc -c /tmp/t.c -Wl,... does not cause a cache hit when the second command is issued. It should. A simple change like the following would suffice: (Sorry this is not in a diff form.) Simply process "-Wl,..." like -Lpath. static struct file_hash * calculate_object_hash(struct args *args, struct mdfour *hash, int direct_mode) { int i; char *manifest_name; struct stat st; int result; struct file_hash *object_hash = NULL; char *p; if (direct_mode) { hash_delimiter(hash, "manifest version"); hash_int(hash, MANIFEST_VERSION); } /* first the arguments */ for (i = 1; i < args->argc; i++) { /* -L doesn't affect compilation. */ if (i < args->argc-1 && str_eq(args->argv[i], "-L")) { i++; continue; } if (str_startswith(args->argv[i], "-L")) { continue; } /* for gcc, -Wl,... is for linker options and so does not affect compilation */ if (str_startswith(args->argv[i], "-Wl,")) { cc_log("(debug) -Wl,... is ignored from hashing."); continue; } I have tested this and it works. make test pass, so I have not incorporated a new bug (maybe I need more test cases, etc.) Thank you in advance for your attention.
Thanks, added in 47f5e8c77d3138beb1087fccb0f76ab76273e4cb on master.
(In reply to Joel Rosdahl from comment #1) Dear Joel, In, https://git.samba.org/?p=ccache.git;a=commit;h=47f5e8c77d3138beb1087fccb0f76ab76273e4cb I noticed that you put a commit message to this patch as follows >Don't include -Wl,... in hash since it doesn't affect compilation > > As suggested by Mutsumi Ishikawa. I am not Mutsumi Ishikawa (of Debian fame?). "Ishikawa" is a rather common name in Japan. Anyway, thank you for incorporating this feature. TIA
Oh, drats. Terribly sorry about the name confusion.
(In reply to Joel Rosdahl from comment #3) No problem. I am working on creating a patch set for "-gsplit-dwarf". I just noticed yesterday that a few changes were made to git repository and so manually updating my source tree. Due to my day job, this patch set has to wait for a few weeks :-( But in the meantime, the clean up continues a little by little incorporating the changes made to the ccache git repository, and |make test| passes, and I am using it for mozilla thunderbird local build, and so should be in a good shape once the patch set is ready so that I can upload it here. TIA
Included in v3.2.