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

Alexey Samsonov samsonov at google.com
Tue Feb 11 00:27:27 PST 2014


  Could you please follow advice from http://llvm.org/docs/Phabricator.html and run smth. like "svn diff --diff-cmd=diff -x -U999999" (or use arc command-line interface to upload diffs), so that it's possible to see more context? Thanks.


================
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;
----------------
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?

================
Comment at: lib/Driver/Tools.cpp:1867
@@ -1866,1 +1866,3 @@
 
+static void addProfileRTFreeBSD(
+    const ToolChain &TC, const ArgList &Args, ArgStringList &CmdArgs) {
----------------
Please re-use/generalize addProfileRT() function.

================
Comment at: lib/Driver/Tools.cpp:1891
@@ +1890,3 @@
+// otherwise this function returns false.
+static bool addSanitizerRTLinkFlagFreeBSD(
+    const ToolChain &TC, const ArgList &Args, ArgStringList &CmdArgs,
----------------
Please re-use/generalize addSanitizerRTFlagsLinux. I really don't like we duplicate the logic for calculating the name/location of sanitizer runtimes, adding --dynamic-list/--export-dynamic etc.

================
Comment at: lib/Driver/Tools.cpp:1910
@@ +1909,3 @@
+        Args.MakeArgString("--dynamic-list=" + LibSanitizer + ".syms"));
+
+  return syms;
----------------
To support previous comment - either comment is now wrong, or you forgot to add --export-dynamic here.

================
Comment at: lib/Driver/Tools.cpp:6116
@@ -5998,3 +6115,3 @@
 
-    if (Args.hasArg(options::OPT_pthread)) {
+    if (Args.hasArg(options::OPT_pthread) || NeedsSanRt || NeedsUbsanRt) {
       if (Args.hasArg(options::OPT_pg))
----------------
I'd prefer to add -lpthread_p in addSanitizerRTLinkFlagsFreeBSD, as we do on Linux.


http://llvm-reviews.chandlerc.com/D2644



More information about the cfe-commits mailing list