Summary: | building i386 support with clang on darwin11 requires -new_linker linker option | ||
---|---|---|---|
Product: | [Developer tools] valgrind | Reporter: | Jack Howarth <howarth> |
Component: | general | Assignee: | Julian Seward <jseward> |
Status: | RESOLVED FIXED | ||
Severity: | normal | CC: | gparker |
Priority: | NOR | ||
Version: | unspecified | ||
Target Milestone: | --- | ||
Platform: | Fink Packages | ||
OS: | macOS | ||
Latest Commit: | Version Fixed In: | ||
Sentry Crash Report: | |||
Attachments: |
Patch to make Valgrind build with Clang on OSX
Fix detection of clang when ccache is used |
Description
Jack Howarth
2012-03-06 17:15:17 UTC
> -$cmd = "$cmd -static";
> +$cmd = "$cmd -static -new_linker";
This is going to need a configure test (or some other way of applying
it only in certain circumstances.) I tried it just now on OSX 10.7
with Xcode 4.1 and the 32-bit tool executables segfault at startup
with it. 64-bit ones are OK.
(In reply to comment #1) > > -$cmd = "$cmd -static"; > > +$cmd = "$cmd -static -new_linker"; > > This is going to need a configure test (or some other way of applying > it only in certain circumstances.) I tried it just now on OSX 10.7 > with Xcode 4.1 and the 32-bit tool executables segfault at startup > with it. 64-bit ones are OK. Do you have the patch in https://bugs.kde.org/show_bug.cgi?id=295428 properly applied? The i386 static executables built with clang will segfault without that fix. I just tested a build of valgrind 3.7.0 using clang and -new_linker and all of the i386 static executables run fine. The same is true when using llvm-gcc-4.2 from Xcode 4.2 and -new_linker. These tests were done on darwin10. Created attachment 71366 [details] Patch to make Valgrind build with Clang on OSX Here's a patch to add "-new_linker" to the linker flags if @CC@ either ends with "clang" or is a symlink to a file that ends with "clang". I hope this is the correct criterion - I adopted the basic idea from the Fink project (http://fink.cvs.sourceforge.net/fink/dists/10.7/stable/main/finkinfo/devel/valgrind.info?view=markup). (In reply to comment #3) > Created attachment 71366 [details] > Patch to make Valgrind build with Clang on OSX Committed w/ modifications, r12766. Thanks. The change is to use the C compiler name that is passed to this script as the second arg instead of looking directly at $CC. Created attachment 73299 [details]
Fix detection of clang when ccache is used
There is still a problem with this method when using ccache for compilation of valgrind. For applying ccache, configure can be run with CC='ccache /usr/bin/clang' and then the perl script would be called like this: ../coregrind/link_tool_exe_darwin 0x138000000 ccache /usr/bin/clang ...
The attached patch adds a check if the second argument is ccache and in this case, the actual path to the compiler is in the next argument.
|