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
This commit is contained in:
mtklein@google.com 2013-10-08 15:16:36 +00:00
parent 055a584abe
commit 9f3b0e462e
4 changed files with 42 additions and 59 deletions

View File

@ -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',
],
}],

View File

@ -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)',

View File

@ -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

34
tools/xsan_build Executable file
View File

@ -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