ref: 39ee898f89bec5aa6137df5ea3179b3564a328aa
parent: 2d86965fee8636f30bd5575f2cf8f6b4f5bfd475
author: Johann <[email protected]>
date: Wed Sep 26 12:52:54 EDT 2018
add cfi sanitizer Change-Id: I4262bb631c248ad188f09a37d774d1759695b0d7
--- a/tools/set_analyzer_env.sh
+++ b/tools/set_analyzer_env.sh
@@ -13,6 +13,7 @@
case "${sanitizer}" in
address) ;;
+ cfi) ;;
integer) ;;
memory) ;;
thread) ;;
@@ -20,7 +21,7 @@
clear)
echo "Clearing environment:"
set -x
- unset CC CXX LD
+ unset CC CXX LD AR
unset CFLAGS CXXFLAGS LDFLAGS
unset ASAN_OPTIONS MSAN_OPTIONS TSAN_OPTIONS UBSAN_OPTIONS
set +x
@@ -74,6 +75,13 @@
# Exact backtraces.
cflags="${cflags} -fno-optimize-sibling-calls"
+if [ "${sanitizer}" = "cfi" ]; then
+ # https://clang.llvm.org/docs/ControlFlowIntegrity.html
+ cflags="${cflags} -flto -fvisibility=hidden"
+ ldflags="${ldflags} -flto -fuse-ld=gold"
+ export AR="llvm-ar"
+fi
+
set -x
export CC="clang"
export CXX="clang++"
@@ -99,6 +107,9 @@
set -x
export ASAN_OPTIONS="${sanitizer_options}"
set +x
+ ;;
+ cfi)
+ # No environment settings
;;
memory)
set -x