Skip to content

Commit

Permalink
Bug 1319361 - add msan builds, r=ttaubert
Browse files Browse the repository at this point in the history
Differential Revision: https://nss-review.dev.mozaws.net/D89

--HG--
extra : rebase_source : 83f4395f8bc4814e38f8af068a0ed89b24749270
extra : amend_source : 1942f6771bd76b5e46e2a9eef9fec1f5ff380102
extra : histedit_source : 3b6d682914c3a44bb9c440eb6132344bbb155fef%2C3730acaa637e35623d588da3b704235607ecf041
  • Loading branch information
franziskuskiefer committed Nov 22, 2016
1 parent 05f837d commit 7ba3213
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 3 deletions.
4 changes: 3 additions & 1 deletion build.sh
Expand Up @@ -14,7 +14,7 @@ cat << EOF
Usage: ${0##*/} [-hcgv] [-j <n>] [--test] [--fuzz] [--scan-build[=output]]
[-m32] [--opt|-o] [--asan] [--ubsan] [--sancov[=edge|bb|func]]
[--pprof]
[--pprof] [--msan]
This script builds NSS with gyp and ninja.
Expand All @@ -36,6 +36,7 @@ NSS build tool options:
--opt|-o do an opt build
--asan do an asan build
--ubsan do an ubsan build
--msan do an msan build
--sancov do sanitize coverage builds
--sancov=func sets coverage to function level for example
--pprof build with gperftool support
Expand Down Expand Up @@ -104,6 +105,7 @@ while [ $# -gt 0 ]; do
--sancov) gyp_params+=(-Duse_sancov=edge); nspr_sanitizer sancov edge ;;
--sancov=?*) gyp_params+=(-Duse_sancov="${1#*=}"); nspr_sanitizer sancov "${1#*=}" ;;
--pprof) gyp_params+=(-Duse_pprof=1) ;;
--msan) gyp_params+=(-Duse_msan=1); nspr_sanitizer msan ;;
*) show_help; exit ;;
esac
shift
Expand Down
16 changes: 16 additions & 0 deletions coreconf/config.gypi
Expand Up @@ -93,6 +93,7 @@
'ssl_enable_zlib%': 1,
'use_asan%': 0,
'use_ubsan%': 0,
'use_msan%': 0,
'use_sancov%': 0,
'test_build%': 0,
'fuzz%': 0,
Expand Down Expand Up @@ -327,6 +328,21 @@
'LIBRARY_SEARCH_PATHS': ['/usr/lib <(ubsan_flags)'],
},
}],
[ 'use_msan==1', {
'variables': {
'msan_flags': '<!(<(python) <(DEPTH)/coreconf/sanitizers.py msan)',
'no_ldflags': '<!(<(python) <(DEPTH)/coreconf/sanitizers.py ld)',
},
'cflags': ['<@(msan_flags)'],
'ldflags': ['<@(msan_flags)'],
'ldflags!': ['<@(no_ldflags)'],
'xcode_settings': {
'OTHER_CFLAGS': ['<@(msan_flags)'],
'OTHER_LDFLAGS!': ['<@(no_ldflags)'],
# See comment above.
'LIBRARY_SEARCH_PATHS': ['/usr/lib <(msan_flags)'],
},
}],
[ 'use_sancov!=0', {
'variables': {
'sancov_flags': '<!(<(python) <(DEPTH)/coreconf/sanitizers.py sancov <(use_sancov))',
Expand Down
8 changes: 6 additions & 2 deletions coreconf/sanitizers.py
Expand Up @@ -5,7 +5,7 @@

def main():
if len(sys.argv) < 2:
raise Exception('Specify either "ld", asan", "sancov" or "ubsan" as argument.')
raise Exception('Specify either "ld", asan", "msan", "sancov" or "ubsan" as argument.')

sanitizer = sys.argv[1]
if sanitizer == "ubsan":
Expand All @@ -15,6 +15,10 @@ def main():
print('-fsanitize=address ', end='')
print('-fno-omit-frame-pointer -fno-optimize-sibling-calls ', end='')
return
if sanitizer == "msan":
print('-fsanitize=memory -fsanitize-memory-track-origins ', end='')
print('-fno-omit-frame-pointer -fno-optimize-sibling-calls ', end='')
return
if sanitizer == "sancov":
if len(sys.argv) < 3:
raise Exception('sancov requires another argument (edge|bb|func).')
Expand All @@ -26,7 +30,7 @@ def main():
print('-Wl,-z,defs ', end='')
return

raise Exception('Specify either "ld", asan", "sancov" or "ubsan" as argument.')
raise Exception('Specify either "ld", asan", "msan", "sancov" or "ubsan" as argument.')

if __name__ == '__main__':
main()

0 comments on commit 7ba3213

Please sign in to comment.