valgrind-3.7.0-fix-ccache-support.patch 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  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. Since this Perl script simply needs to add additional flags to the
  10. command line, we simply add them at the end of the command line
  11. instead of trying to add them at the beginning.
  12. Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
  13. Index: valgrind-3.6.1/coregrind/link_tool_exe_linux.in
  14. ===================================================================
  15. --- valgrind-3.6.1.orig/coregrind/link_tool_exe_linux.in 2011-12-22 13:59:08.933499060 +0100
  16. +++ valgrind-3.6.1/coregrind/link_tool_exe_linux.in 2011-12-22 13:59:50.302782709 +0100
  17. @@ -55,25 +55,13 @@
  18. if (($#ARGV + 1) < 5);
  19. my $ala = $ARGV[0];
  20. +shift;
  21. # check for plausible-ish alt load address
  22. die "Bogus alt-load address"
  23. if (length($ala) < 3 || index($ala, "0x") != 0);
  24. -# The cc invokation to do the final link
  25. -my $cc = $ARGV[1];
  26. -
  27. -# and the 'restargs' are argv[2 ..]
  28. -
  29. -# so, build up the complete command here:
  30. -# 'cc' -static -Ttext='ala' 'restargs'
  31. -
  32. -my $cmd="$cc -static -Wl,-Ttext=$ala";
  33. -
  34. -# Add the rest of the parameters
  35. -foreach my $n (2 .. $#ARGV) {
  36. - $cmd = "$cmd $ARGV[$n]";
  37. -}
  38. +my $cmd=join(" ", @ARGV) . " -static -Wl,-Ttext=$ala";
  39. #print "link_tool_exe_linux: $cmd\n";