[PATCH] add supporting of the sanitizer arguments into Clang on FreeBSD platform.

Viktor Kutuzov vkutuzov at accesssoftek.com
Tue Feb 18 08:42:39 PST 2014

  Regarding handling of the "-lpthread*" option: I tried to move the code adding various libraries to addSanitizerRTLinkFlagsLinux[OrFreeBSD]() and that resulted in a somewhat larger function with a lot of conditions for different libraries. No problem with implementing it this way, but it seems the readability suffers significantly.

Comment at: lib/Driver/SanitizerArgs.cpp:249
@@ -248,2 +248,3 @@
                                                unsigned &DiagnosedKinds) {
-  bool IsLinux = TC.getTriple().getOS() == llvm::Triple::Linux;
+  bool IsPosix = TC.getTriple().getOS() == llvm::Triple::Linux ||
+                 TC.getTriple().getOS() == llvm::Triple::FreeBSD;
Alexey Samsonov wrote:
> IsPosix name is bad, Mac OS X is also Posix. You can just use "IsLinuxOrFreeBSD".
> By the way, did you really check that TSan, MSan, DFSan all work on FreeBSD?
Yes, with corresponding changes applied (not submitted for review yet) we do support those on FreeBSD.

Comment at: lib/Driver/Tools.cpp:1910
@@ +1909,3 @@
+        Args.MakeArgString("--dynamic-list=" + LibSanitizer + ".syms"));
+  return syms;
Alexey Samsonov wrote:
> To support previous comment - either comment is now wrong, or you forgot to add --export-dynamic here.
I will fix this, but just to make the logic clear: in this case we return true to let the caller know we should append "--export-dynamic".


More information about the cfe-commits mailing list