aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar mtklein@google.com <mtklein@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2013-10-08 15:16:36 +0000
committerGravatar mtklein@google.com <mtklein@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2013-10-08 15:16:36 +0000
commit9f3b0e462e895f31dd68b311f915d1c2763edb9e (patch)
tree9b35c8b0a8afe98500caadaad6ac251e89b760d5
parent055a584abe73151b86a1f68a35daddc2fd2559a1 (diff)
skia/trunk changes for generic sanitizer gyp flag.
BUG= R=borenet@google.com Review URL: https://codereview.chromium.org/25564003 git-svn-id: http://skia.googlecode.com/svn/trunk@11648 2bbb7eff-a529-9590-31e7-b0007b416f81
-rw-r--r--gyp/common_conditions.gypi17
-rw-r--r--gyp/common_variables.gypi8
-rwxr-xr-xtools/asan_build42
-rwxr-xr-xtools/xsan_build34
4 files changed, 42 insertions, 59 deletions
diff --git a/gyp/common_conditions.gypi b/gyp/common_conditions.gypi
index f8012b99d5..1cbdd7b45a 100644
--- a/gyp/common_conditions.gypi
+++ b/gyp/common_conditions.gypi
@@ -277,26 +277,19 @@
}],
],
}],
- [ 'skia_asan_build', {
+ # Enable asan, tsan, etc.
+ [ 'skia_sanitizer', {
'cflags': [
- '-fsanitize=address',
+ '-fsanitize=<(skia_sanitizer)',
'-fno-omit-frame-pointer',
],
'ldflags': [
- '-fsanitize=address',
- ],
- }],
- [ 'skia_tsan_build', {
- 'cflags': [
- '-fsanitize=thread',
- '-fno-omit-frame-pointer',
- ],
- 'ldflags': [
- '-fsanitize=thread',
+ '-fsanitize=<(skia_sanitizer)',
],
}],
[ 'skia_clang_build', {
'cflags': [
+ # Extra warnings we like but that only Clang knows about.
'-Wstring-conversion',
],
}],
diff --git a/gyp/common_variables.gypi b/gyp/common_variables.gypi
index 3f7b154b6f..9aeee62f9d 100644
--- a/gyp/common_variables.gypi
+++ b/gyp/common_variables.gypi
@@ -78,8 +78,7 @@
}],
],
- 'skia_asan_build%': 0,
- 'skia_tsan_build%': 0,
+ 'skia_sanitizer%': '',
'skia_scalar%': 'float',
'skia_mesa%': 0,
'skia_nv_path_rendering%': 0,
@@ -119,7 +118,7 @@
}, {
'skia_release_optimization_level%': '<(skia_default_gcc_optimization_level)',
}],
- [ 'skia_asan_build or skia_tsan_build', {
+ [ 'skia_sanitizer', {
'skia_clang_build': 1,
}, {
'skia_clang_build%': 0,
@@ -133,8 +132,7 @@
'arm_neon_optional%': 0,
'skia_os%': '<(skia_os)',
'os_posix%': '<(os_posix)',
- 'skia_asan_build%': '<(skia_asan_build)',
- 'skia_tsan_build%': '<(skia_tsan_build)',
+ 'skia_sanitizer%': '<(skia_sanitizer)',
'skia_scalar%': '<(skia_scalar)',
'skia_mesa%': '<(skia_mesa)',
'skia_nv_path_rendering%': '<(skia_nv_path_rendering)',
diff --git a/tools/asan_build b/tools/asan_build
deleted file mode 100755
index 49817f66d4..0000000000
--- a/tools/asan_build
+++ /dev/null
@@ -1,42 +0,0 @@
-#!/bin/bash
-
-# Build Skia with Address Sanitizer.
-#
-# Address Sanitizer is available in LLVM (and Clang) 3.1 and above, as well as
-# GCC 4.8. For now, this script assumes the use of Clang 3.2 or newer, which
-# uses different flag syntax from 3.1.
-#
-# For more information, see:
-# https://code.google.com/p/address-sanitizer/wiki/AddressSanitizer
-
-makeVars="$@"
-
-export CC="$(which clang)"
-export CXX="$(which clang++)"
-export LINK="$(which clang)"
-
-noClang="Couldn't find Clang on this machine!"
-if [[ -z "${CC}" ]]; then
- echo "${noClang}"
- exit 1
-fi
-if [[ -z "${CXX}" ]]; then
- echo "${noClang}"
- exit 1
-fi
-if [[ -z "${LINK}" ]]; then
- echo "${noClang}"
- exit 1
-fi
-
-export GYP_DEFINES="skia_asan_build=1 ${GYP_DEFINES}"
-
-python gyp_skia
-if [[ "$?" != "0" ]]; then
- exit 1
-fi
-
-make ${makeVars}
-if [[ "$?" != "0" ]]; then
- exit 1
-fi \ No newline at end of file
diff --git a/tools/xsan_build b/tools/xsan_build
new file mode 100755
index 0000000000..f4d82e9b9f
--- /dev/null
+++ b/tools/xsan_build
@@ -0,0 +1,34 @@
+#!/bin/bash
+
+# Build Skia with one of Clang's many sanitizers.
+#
+# $ tools/xsan_build {address,thread,undefined,etc.} [any other flags to pass to make/ninja...]
+#
+# This script assumes the use of Clang >=3.2.
+#
+# For more information, see:
+# http://clang.llvm.org/docs/UsersManual.html#controlling-code-generation
+
+set -e
+
+sanitizer=$1
+shift
+args="$@"
+
+export CC="$(which clang)"
+export CXX="$(which clang++)"
+export LINK="$(which clang)"
+
+if [[ -z "${CC}" ]] || [[ -z "${CXX}" ]] || [[ -z "${LINK}" ]]; then
+ echo "Couldn't find Clang on this machine!"
+ exit 1
+fi
+
+export GYP_DEFINES="skia_sanitizer=$sanitizer ${GYP_DEFINES}"
+
+./gyp_skia
+if [[ $GYP_GENERATORS == "ninja" ]]; then
+ ninja ${args}
+else
+ make ${args}
+fi