Bug 8906 - regression from 2.4 when multiple compilers are hard linked
Summary: regression from 2.4 when multiple compilers are hard linked
Status: CLOSED WORKSFORME
Alias: None
Product: ccache
Classification: Unclassified
Component: ccache (show other bugs)
Version: 3.0
Hardware: All AIX
: P5 normal
Target Milestone: ---
Assignee: Joel Rosdahl
QA Contact: Joel Rosdahl
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-04-29 09:13 UTC by Nicholas Clark
Modified: 2013-01-05 17:23 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Nicholas Clark 2012-04-29 09:13:44 UTC
Thanks for ccache, which I continue to find very useful, and a massive time saver.

However, I've hit a problem. The fix made with commit 2c629987c2667667df136fbf3413b2d192a9dd5e has been regressed.

Specifically, if a single binary is used as the front end for more than one compiler variant, hard linked with more than one name, and compiler behaviour varies depending on which name is used to invoke it, then the object file output by the compiler can vary as a function of the compiler name, even for the same pre-processed input and command line flags.

On AIX, this is the case. Specifically, xlc and cc_r are quite different in behaviour, but they are invoked via the same binary on disk:

$ ls -li /usr/vac/bin/xlc /usr/vac/bin/cc_r
238514 -r-xr-xr-x   32 bin      bin          310036 Mar 11 2011  /usr/vac/bin/cc_r
238514 -r-xr-xr-x   32 bin      bin          310036 Mar 11 2011  /usr/vac/bin/xlc

A fix was put in for this with commit 4ebb9a36352c6127ea76317f7a86eaad54bae076,
adding the compiler name to the hash if the link count is more than 1.

However, that fix was unfortunately removed as a side effect of the refactoring of commit a60d2af7c28482284973e768b98f4cd15a3096cf.

The result is strange and mysterious build failures on AIX, when test building a project in turn with more than one compiler.

Nicholas Clark
Comment 1 Joel Rosdahl 2012-05-13 19:49:03 UTC
(In reply to comment #0)
> [...]
> A fix was put in for this with commit 4ebb9a36352c6127ea76317f7a86eaad54bae076,
> adding the compiler name to the hash if the link count is more than 1.
> 
> However, that fix was unfortunately removed as a side effect of the refactoring
> of commit a60d2af7c28482284973e768b98f4cd15a3096cf.

That commit indeed removed the check for a link count greater than 1, but the name is still hashed (so now it's always hashed). And I think that's the correct thing to do, since ccache otherwise would be mislead by this:

  rm /usr/vac/bin/xlc # ...and all other hard links except cc_r
  ccache /usr/vac/bin/cc_r ...
  mv /usr/vac/bin/cc_r /usr/vac/bin/xlc
  ccache /usr/vac/bin/xlc ...

> The result is strange and mysterious build failures on AIX, when test building
> a project in turn with more than one compiler.

This sounds strange since your original suggestion should still be there. Could it be some other problem?
Comment 2 Joel Rosdahl 2012-08-09 13:19:01 UTC
(In reply to comment #1)
> This sounds strange since your original suggestion should still be there. Could
> it be some other problem?

Nicholas, do you have more input on this? Otherwise, I think I'll close the bug report.
Comment 3 Joel Rosdahl 2013-01-05 17:22:35 UTC
I'm closing this bug now. Please reopen it if you think the bug still exists.