dynamic data flow analysis framework to be used by clients to help
detect application-specific issues within their own code.
+How to build libc++ with DFSan
+==============================
+
+DFSan requires either all of your code to be instrumented or for uninstrumented
+functions to be listed as``uninstrumented`` in the `ABI list`_.
+
+If you'd like to have instrumented libc++ functions, then you need to build it
+with DFSan instrumentation from source. Here is an example of how to build
+libc++ and the libc++ ABI with data flow sanitizer instrumentation.
+
+.. code-block:: console
+ cd libcxx-build
+
+ # An example using ninja
+ cmake -GNinja path/to/llvm-project/llvm \
+ -DCMAKE_C_COMPILER=clang \
+ -DCMAKE_CXX_COMPILER=clang++ \
+ -DLLVM_USE_SANITIZER="DataFlow" \
+ -DLLVM_ENABLE_LIBCXX=ON \
+ -DLLVM_ENABLE_PROJECTS="libcxx;libcxxabi"
+
+ ninja cxx cxxabi
+
+Note: Ensure you are building with a sufficiently new version of Clang.
+
Usage
=====
For further information about each function, please refer to the header
file.
+.. _ABI list:
+
ABI List
--------
append_flags(SANITIZER_FLAGS "-fsanitize=address,undefined -fno-sanitize=vptr,function -fno-sanitize-recover=all")
elseif (USE_SANITIZER STREQUAL "Thread")
append_flags(SANITIZER_FLAGS -fsanitize=thread)
+ elseif (USE_SANITIZER STREQUAL "DataFlow")
+ append_flags(SANITIZER_FLAGS -fsanitize=dataflow)
else()
message(WARNING "Unsupported value of LLVM_USE_SANITIZER: ${USE_SANITIZER}")
endif()
self.cxx.flags += ['-fsanitize=thread']
self.config.available_features.add('tsan')
self.config.available_features.add('sanitizer-new-delete')
+ elif san == 'DataFlow':
+ self.cxx.flags += ['-fsanitize=dataflow']
else:
self.lit_config.fatal('unsupported value for '
'use_sanitizer: {0}'.format(san))
elseif (LLVM_USE_SANITIZER STREQUAL "Thread")
append_common_sanitizer_flags()
append("-fsanitize=thread" CMAKE_C_FLAGS CMAKE_CXX_FLAGS)
+ elseif (LLVM_USE_SANITIZER STREQUAL "DataFlow")
+ append("-fsanitize=dataflow" CMAKE_C_FLAGS CMAKE_CXX_FLAGS)
elseif (LLVM_USE_SANITIZER STREQUAL "Address;Undefined" OR
LLVM_USE_SANITIZER STREQUAL "Undefined;Address")
append_common_sanitizer_flags()
**LLVM_USE_SANITIZER**:STRING
Define the sanitizer used to build LLVM binaries and tests. Possible values
are ``Address``, ``Memory``, ``MemoryWithOrigins``, ``Undefined``, ``Thread``,
- and ``Address;Undefined``. Defaults to empty string.
+ ``DataFlow``, and ``Address;Undefined``. Defaults to empty string.
**LLVM_ENABLE_LTO**:STRING
Add ``-flto`` or ``-flto=`` flags to the compile and link command