[PATCH] D15225: [Driver] Sanitizer support based on runtime library presence

Kuba Brecka via llvm-commits llvm-commits at lists.llvm.org
Fri Dec 4 03:39:14 PST 2015


kubabrecka created this revision.
kubabrecka added reviewers: beanz, samsonov, bob.wilson, pcc, kcc, glider, t.p.northover.
kubabrecka added subscribers: llvm-commits, zaks.anna.

The runtime libraries of sanitizers are built in compiler-rt, and Clang can be built without compiler-rt, or compiler-rt can be configured to only build certain sanitizers.  The driver should provide reasonable diagnostics and not a link-time error when a runtime library is missing.  Some sanitizers can still be useful even without the runtime library, e.g. when `-fsanitize=undefined` is used together with `fsanitize-trap=undefined`.

This patch changes the driver for OS X to only support sanitizers of which we can find the runtime libraries, with the exception that certain sanitizers can still be used if `-fsanitize-trap=...` is used for them.  For these, if `-fsanitize-trap` is not specified, we produce a diagnostic suggesting to use it.

Modified the fsanitize.c lit test to have two variants for Darwin, one with a resource directory that doesn't have the sanitizers, and one (`resource_dir_darwin_sanitizers/`) which has placeholder files as the libraries.

http://reviews.llvm.org/D15225

Files:
  include/clang/Basic/DiagnosticDriverKinds.td
  include/clang/Driver/ToolChain.h
  lib/Driver/SanitizerArgs.cpp
  lib/Driver/ToolChain.cpp
  lib/Driver/ToolChains.cpp
  lib/Driver/ToolChains.h
  test/Driver/Inputs/resource_dir_darwin_sanitizers/lib/darwin/libclang_rt.asan_iossim_dynamic.dylib
  test/Driver/Inputs/resource_dir_darwin_sanitizers/lib/darwin/libclang_rt.asan_osx_dynamic.dylib
  test/Driver/Inputs/resource_dir_darwin_sanitizers/lib/darwin/libclang_rt.tsan_osx_dynamic.dylib
  test/Driver/Inputs/resource_dir_darwin_sanitizers/lib/darwin/libclang_rt.ubsan_iossim_dynamic.dylib
  test/Driver/Inputs/resource_dir_darwin_sanitizers/lib/darwin/libclang_rt.ubsan_osx_dynamic.dylib
  test/Driver/darwin-asan-nofortify.c
  test/Driver/darwin-sanitizer-ld.c
  test/Driver/fsanitize.c
  test/Driver/sanitizer-ld.c

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D15225.41862.patch
Type: text/x-patch
Size: 19990 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20151204/4ad2f349/attachment.bin>


More information about the llvm-commits mailing list