This patch provides the following functionality:
- allows the FreeBSD platform in the sanitizer argument filters;
- adds the linker cmdline args and RT libraries in according of specified sanitizer arguments (--sanitize=...) for the FreeBSD targets.
Differential D2644
add supporting of the sanitizer arguments into Clang on FreeBSD platform. kutuzov.viktor.84 on Jan 28 2014, 3:34 PM. Authored by
Details
Diff Detail Event TimelineComment Actions This patch needs a corresponding set of tests in test/Driver. Do the asan, msan, tsan, ubsan, ... test suites pass on freebsd with this change?
Comment Actions 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 Actions Tests added.
No, that require further changes in compiler-rt. The test suites are not enabled for FreeBSD yet. Comment Actions In this case it probably makes sense to keep that sanitizers as "unsupported" on FreeBSD for now. Comment Actions 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 Actions OK, it looks there is a lot of details that require deep and careful analysis against recent revisions--more than I could do with the current level of the sanitizers support on FreeBSD. So, I propose we defer this patch untill we need it to run the tests and then make as small changes as possible and only if necessary. Please let me know if you think that would work. Thanks. Comment Actions OK, I don't mind it. I will hopefully do some cleanup/generalization for sanitizers support in the Driver code that will help you minimize the changes to enable them on FreeBSD. Comment Actions Updated to leverage changes by Alexey Samsonov. The change in getCompilerRTLibDir() is necessary as otherwise it yields "lib/freebsd10.0" on FreeBSD 10.0 whereas "lib/freebsd" (without the version number) is expected. Thanks, Alexey! Comment Actions Please add a testcase. It should probably go to test/Driver/sanitizer-ld.c
Comment Actions Updated. Alexey, please let me know if you would prefer explicit "freebsd" instead of calling Triple::getOSTypeName(). Thanks. |
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?