valgrind-fix-ccache-support.patch 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. Fix link_tool_exe_linux.in to work with ccache
  2. The link_tool_exe_linux.in Perl script makes the assumption that the
  3. compilation command line is always:
  4. gcc -o foobar foobar.c -someflags
  5. I.e, it assumes that the compiler is the first word of the command
  6. line. However, this is not true with ccache, where the command line
  7. is:
  8. /path/to/ccache /path/to/crossgcc -o foobar foobar.c -someflags
  9. Therefore, we tune the script to take into account the case where
  10. ccache is used.
  11. Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
  12. Index: b/coregrind/link_tool_exe_linux.in
  13. ===================================================================
  14. --- a/coregrind/link_tool_exe_linux.in
  15. +++ b/coregrind/link_tool_exe_linux.in
  16. @@ -60,8 +60,16 @@
  17. die "Bogus alt-load address"
  18. if (length($ala) < 3 || index($ala, "0x") != 0);
  19. +shift(@ARGV);
  20. +
  21. +if ($ARGV[0] =~ /.*ccache/) {
  22. + shift(@ARGV);
  23. +}
  24. +
  25. # The cc invokation to do the final link
  26. -my $cc = $ARGV[1];
  27. +my $cc = $ARGV[0];
  28. +
  29. +shift(@ARGV);
  30. # and the 'restargs' are argv[2 ..]
  31. @@ -82,7 +90,7 @@
  32. }
  33. # Add the rest of the parameters
  34. -foreach my $n (2 .. $#ARGV) {
  35. +foreach my $n (0 .. $#ARGV) {
  36. $cmd = "$cmd $ARGV[$n]";
  37. }