Skip to content

Commit

Permalink
Add config to build with asan (#2490)
Browse files Browse the repository at this point in the history
Building with RBE will require upgrading to Bazel 3.0+ because of google/oss-fuzz#3093. TF is already on 3.1.0, so we should probably upgrade anyway.

Tested:
`bazel test --config=rs --config=asan //iree/...`
Two vulkan failures:
https://source.cloud.google.com/results/invocations/fa1c4e13-305e-4467-aac5-97773a0ecf57

Reverted the type registration added to fix a leak in dde06c0 and confirmed an asan failure
`bazel test --config=rs --config=asan //iree/vm:list_test`
https://source.cloud.google.com/results/invocations/7dfc3bcc-b837-4139-9649-f4156dd782bf
  • Loading branch information
GMNGeoffrey authored Jul 14, 2020
1 parent b093bdd commit ac43812
Showing 1 changed file with 26 additions and 1 deletion.
27 changes: 26 additions & 1 deletion .bazelrc
Original file line number Diff line number Diff line change
Expand Up @@ -70,14 +70,39 @@ build:generic_clang --cxxopt=-std=c++14 --host_cxxopt=-std=c++14
# This is a good compromise between runtime and debugability.
build:generic_clang --copt=-UNDEBUG

###############################################################################
# Options for building with address sanitizer.
# https://github.com/google/sanitizers/wiki/AddressSanitizer
###############################################################################

# Turn on asan. Some toolchains make use of the asan feature and we'll directly
# set the appropriate opts.
build:asan --features=asan
build:asan --copt=-fsanitize=address
build:asan --linkopt=-fsanitize=address

# Don't strip debug info
build:asan --strip=never
# Ignore settings of `linkopts = ["-static"]` which can screw up the sanitizer.
# We don't use this in IREE (that's what linkstatic is for), but it could show
# up in dependencies.
build:asan --force_ignore_dash_static
# asan tests tend to take longer, so increase the timeouts
build:asan --test_timeout=120,600,1800,-1
# Make the outputs easy to find
build:asan --cc_output_directory_tag=asan
# Get better stack traces
build:asan --copt=-fno-omit-frame-pointer
# This macro define is used by absl
build:asan --copt=-DADDRESS_SANITIZER

###############################################################################
# Architecture specific options
###############################################################################

# Enable some default cpu flags for x86 optimization.
build:x86opt --copt=-mavx2


###############################################################################

# Options for connecting to the IREE GCP remote build project.
Expand Down

0 comments on commit ac43812

Please sign in to comment.