Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1705)

Unified Diff: third_party/instrumented_libraries/download_build_install.py

Issue 96083003: Add instrumented libraries build with msan (Closed) Base URL: https://src.chromium.org/chrome/trunk/src/
Patch Set: Created 7 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « build/common.gypi ('k') | third_party/instrumented_libraries/instrumented_libraries.gyp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/instrumented_libraries/download_build_install.py
===================================================================
--- third_party/instrumented_libraries/download_build_install.py (revision 238347)
+++ third_party/instrumented_libraries/download_build_install.py (working copy)
@@ -11,8 +11,18 @@
import subprocess
import sys
-# Should be a dict from 'sanitizer type' to 'compiler flag'.
-SUPPORTED_SANITIZERS = {'asan': 'address'}
+# Build parameters for different sanitizers
+SUPPORTED_SANITIZERS = {
+ 'asan': {
+ 'compiler_flags': '-fsanitize=address -gline-tables-only -fPIC -w',
+ 'linker_flags': '-fsanitize=address -Wl,-z,origin -Wl,-R,XORIGIN/.'
+ },
+ 'msan': {
+ 'compiler_flags': '-fsanitize=memory -fsanitize-memory-track-origins '
+ '-gline-tables-only -fPIC -w',
+ 'linker_flags': '-fsanitize=memory -Wl,-z,origin -Wl,-R,XORIGIN/.'
+ },
+}
class ScopedChangeDirectory(object):
@@ -37,23 +47,25 @@
command = 'apt-get -s build-dep %s | grep Inst | cut -d " " -f 2' % library
command_result = subprocess.Popen(command, stdout=subprocess.PIPE,
shell=True)
+ if command_result.wait():
+ raise Exception("Failed to determine build dependencies for %s" % library)
build_dependencies = [l.strip() for l in command_result.stdout]
return build_dependencies
def download_build_install(parsed_arguments):
- sanitizer_flag = SUPPORTED_SANITIZERS[parsed_arguments.sanitizer_type]
+ sanitizer_params = SUPPORTED_SANITIZERS[parsed_arguments.sanitizer_type]
environment = os.environ.copy()
- environment['CFLAGS'] = '-fsanitize=%s -g -fPIC -w' % sanitizer_flag
- environment['CXXFLAGS'] = '-fsanitize=%s -g -fPIC -w' % sanitizer_flag
+ environment['CFLAGS'] = sanitizer_params['compiler_flags']
+ environment['CXXFLAGS'] = sanitizer_params['compiler_flags']
# We use XORIGIN as RPATH and after building library replace it to $ORIGIN
# The reason: this flag goes through configure script and makefiles
# differently for different libraries. So the dollar sign '$' should be
# differently escaped. Instead of having problems with that it just
# uses XORIGIN to build library and after that replaces it to $ORIGIN
# directly in .so file.
- environment['LDFLAGS'] = '-Wl,-z,origin -Wl,-R,XORIGIN/.'
+ environment['LDFLAGS'] = sanitizer_params['linker_flags']
library_directory = '%s/%s' % (parsed_arguments.intermediate_directory,
parsed_arguments.library)
« no previous file with comments | « build/common.gypi ('k') | third_party/instrumented_libraries/instrumented_libraries.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698