summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xbuild.sh1
-rw-r--r--coreconf/sanitizers.py7
-rw-r--r--coreconf/sanitizers.sh5
-rw-r--r--help.txt1
4 files changed, 12 insertions, 2 deletions
diff --git a/build.sh b/build.sh
index fdcbbf890..bbb8d04a4 100755
--- a/build.sh
+++ b/build.sh
@@ -104,6 +104,7 @@ while [ $# -gt 0 ]; do
--pprof) gyp_params+=(-Duse_pprof=1) ;;
--asan) enable_sanitizer asan ;;
--msan) enable_sanitizer msan ;;
+ --sourcecov) enable_sourcecov ;;
--ubsan) enable_ubsan ;;
--ubsan=?*) enable_ubsan "${1#*=}" ;;
--fuzz) fuzz=1 ;;
diff --git a/coreconf/sanitizers.py b/coreconf/sanitizers.py
index 8735aad61..deeb08cba 100644
--- a/coreconf/sanitizers.py
+++ b/coreconf/sanitizers.py
@@ -5,7 +5,7 @@ import sys
def main():
if len(sys.argv) < 2:
- raise Exception('Specify either "asan", "msan", "sancov" or "ubsan" as argument.')
+ raise Exception('Specify either "asan", "msan", "sancov", "sourcecov" or "ubsan" as argument.')
sanitizer = sys.argv[1]
if sanitizer == "ubsan":
@@ -26,8 +26,11 @@ def main():
raise Exception('sancov requires another argument (edge|bb|func).')
print('-fsanitize-coverage='+sys.argv[2]+' ', end='')
return
+ if sanitizer == "sourcecov":
+ print('-fprofile-instr-generate -fcoverage-mapping', end='')
+ return
- raise Exception('Specify either "asan", "msan", "sancov" or "ubsan" as argument.')
+ raise Exception('Specify either "asan", "msan", "sancov", "sourcecov" or "ubsan" as argument.')
if __name__ == '__main__':
main()
diff --git a/coreconf/sanitizers.sh b/coreconf/sanitizers.sh
index bd77571ed..739f831c0 100644
--- a/coreconf/sanitizers.sh
+++ b/coreconf/sanitizers.sh
@@ -42,6 +42,11 @@ enable_sancov()
enable_sanitizer sancov "$sancov"
}
+enable_sourcecov()
+{
+ enable_sanitizer sourcecov
+}
+
enable_ubsan()
{
local ubsan
diff --git a/help.txt b/help.txt
index 06d5fe163..6034cfd41 100644
--- a/help.txt
+++ b/help.txt
@@ -32,6 +32,7 @@ NSS build tool options:
--msan enable memory sanitizer
--ubsan enable undefined behavior sanitizer
--ubsan=bool,shift,... sets specific UB sanitizers
+ --sourcecov enable source-based coverage sanitizer
--fuzz build fuzzing targets (this always enables static builds)
--fuzz=tls to enable TLS fuzzing mode
--fuzz=oss to build for OSS-Fuzz