diff options
author | sbc <sbc@chromium.org> | 2015-05-26 14:46:27 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-05-26 21:47:43 +0000 |
commit | 39e322114122547e93dc76ef76b124b8ff3bb830 (patch) | |
tree | 70b37386f9dd488772327bdd31bf917a3e161d94 /native_client_sdk | |
parent | 55209c21bf00a57947282189184c812725c72948 (diff) | |
download | chromium_src-39e322114122547e93dc76ef76b124b8ff3bb830.zip chromium_src-39e322114122547e93dc76ef76b124b8ff3bb830.tar.gz chromium_src-39e322114122547e93dc76ef76b124b8ff3bb830.tar.bz2 |
[NaCl SDK] Add ASAN and TSAN build configurations SDK build system
This enables users of the SDK build system to quickly
enable ASAN/TSAN builds. This support in test_sdk.py
had also bittrotted a little since we don't yet enable
this on the bots.
Also, remove redundant -fPIC flag.
Review URL: https://codereview.chromium.org/1152333007
Cr-Commit-Position: refs/heads/master@{#331444}
Diffstat (limited to 'native_client_sdk')
-rwxr-xr-x | native_client_sdk/src/build_tools/test_sdk.py | 8 | ||||
-rw-r--r-- | native_client_sdk/src/tools/host_gcc.mk | 32 |
2 files changed, 32 insertions, 8 deletions
diff --git a/native_client_sdk/src/build_tools/test_sdk.py b/native_client_sdk/src/build_tools/test_sdk.py index 4c7d957..2fa9fd6 100755 --- a/native_client_sdk/src/build_tools/test_sdk.py +++ b/native_client_sdk/src/build_tools/test_sdk.py @@ -83,10 +83,10 @@ def StepRunSelLdrTests(pepperdir, sanitizer): deps = True if sanitizer == 'valgrind': args += ['RUN_UNDER=valgrind'] - else: - args += ['CC=clang', 'CXX=clang++', - 'LDFLAGS=-pie -fsanitize=' + sanitizer, - 'CFLAGS=-fPIC -fsanitize=' + sanitizer] + elif sanitizer == 'address': + args += ['ASAN=1'] + elif sanitizer == 'thread': + args += ['TSAN=1'] build_projects.BuildProjectsBranch(pepperdir, 'src', clean=False, deps=deps, config=config, args=args + ['clean']) diff --git a/native_client_sdk/src/tools/host_gcc.mk b/native_client_sdk/src/tools/host_gcc.mk index 604b073..49fb6d3 100644 --- a/native_client_sdk/src/tools/host_gcc.mk +++ b/native_client_sdk/src/tools/host_gcc.mk @@ -7,6 +7,13 @@ # http://www.gnu.org/software/make/manual/make.html # +ifdef ASAN +CLANG = 1 +endif + +ifdef TSAN +CLANG = 1 +endif # # Macros for TOOLS @@ -14,8 +21,16 @@ # We use the C++ compiler for everything and then use the -Wl,-as-needed flag # in the linker to drop libc++ unless it's actually needed. # -CC ?= $(NACL_COMPILER_PREFIX) gcc -CXX ?= $(NACL_COMPILER_PREFIX) g++ +ifdef CLANG +CC = clang +CXX = clang++ +endif + +ifdef NACL_COMPILER_PREFIX +CC = $(NACL_COMPILER_PREFIX) $(CC) +CXX = $(NACL_COMPILER_PREFIX) $(CXX) +endif + LINK ?= $(CXX) AR ?= ar ARFLAGS = -crs @@ -44,6 +59,15 @@ HOST_LDFLAGS ?= -Wl,-map -Wl,$(OUTDIR)/$(TARGET).map HOST_CFLAGS += -I$(NACL_SDK_ROOT)/include/linux endif +ifdef ASAN +HOST_CFLAGS += -fsanitize=address +HOST_LDFLAGS += -pie -fsanitize=address +endif + +ifdef TSAN +HOST_CFLAGS += -fsanitize=thread +HOST_LDFLAGS += -pie -fsanitize=thread +endif # # Individual Macros @@ -54,14 +78,14 @@ endif define C_COMPILER_RULE -include $(call SRC_TO_DEP,$(1)) $(call SRC_TO_OBJ,$(1)): $(1) $(TOP_MAKE) | $(dir $(call SRC_TO_OBJ,$(1)))dir.stamp - $(call LOG,CC ,$$@,$(CC) -o $$@ -c $$< -fPIC $(POSIX_CFLAGS) $(HOST_CFLAGS) $(CFLAGS) $(2)) + $(call LOG,CC ,$$@,$(CC) -o $$@ -c $$< $(POSIX_CFLAGS) $(HOST_CFLAGS) $(CFLAGS) $(2)) @$(FIXDEPS) $(call SRC_TO_DEP_PRE_FIXUP,$(1)) endef define CXX_COMPILER_RULE -include $(call SRC_TO_DEP,$(1)) $(call SRC_TO_OBJ,$(1)): $(1) $(TOP_MAKE) | $(dir $(call SRC_TO_OBJ,$(1)))dir.stamp - $(call LOG,CXX ,$$@,$(CXX) -o $$@ -c $$< -fPIC $(POSIX_CFLAGS) $(HOST_CFLAGS) $(CXXFLAGS) $(2)) + $(call LOG,CXX ,$$@,$(CXX) -o $$@ -c $$< $(POSIX_CFLAGS) $(HOST_CFLAGS) $(CXXFLAGS) $(2)) @$(FIXDEPS) $(call SRC_TO_DEP_PRE_FIXUP,$(1)) endef |