Fix link_tool_exe_linux.in to work with ccache The link_tool_exe_linux.in Perl script makes the assumption that the compilation command line is always: gcc -o foobar foobar.c -someflags I.e, it assumes that the compiler is the first word of the command line. However, this is not true with ccache, where the command line is: /path/to/ccache /path/to/crossgcc -o foobar foobar.c -someflags Therefore, we tune the script to take into account the case where ccache is used. Signed-off-by: Thomas Petazzoni Index: b/coregrind/link_tool_exe_linux.in =================================================================== --- a/coregrind/link_tool_exe_linux.in +++ b/coregrind/link_tool_exe_linux.in @@ -60,8 +60,16 @@ die "Bogus alt-load address" if (length($ala) < 3 || index($ala, "0x") != 0); +shift(@ARGV); + +if ($ARGV[0] =~ /.*ccache/) { + shift(@ARGV); +} + # The cc invokation to do the final link -my $cc = $ARGV[1]; +my $cc = $ARGV[0]; + +shift(@ARGV); # and the 'restargs' are argv[2 ..] @@ -82,7 +90,7 @@ } # Add the rest of the parameters -foreach my $n (2 .. $#ARGV) { +foreach my $n (0 .. $#ARGV) { $cmd = "$cmd $ARGV[$n]"; }