Skip to content

Commit

Permalink
Using an external toolchain to run address sanitizer runs.
Browse files Browse the repository at this point in the history
Clang+libc++ detects some more situations.

Signed-off-by: Henner Zeller <[email protected]>
  • Loading branch information
hzeller committed Jan 24, 2022
1 parent a3b5bed commit 6af6c24
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .bazelrc
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@ common:macos --features=-supports_dynamic_linker --cxxopt=-std=c++17 --host_cxxo
common:windows --compiler=clang-cl --cxxopt=/std:c++17 --host_cxxopt=/std:c++17 --client_env=BAZEL_CXXOPTS=/std:c++17

# Address sanitizer settings.
build:asan --crosstool_top=@sanitizer_toolchain//:toolchain
build:asan --strip=never
build:asan --copt -fsanitize=address
build:asan --copt -DADDRESS_SANITIZER
build:asan --copt -O1
build:asan --copt -g
build:asan --copt -fno-omit-frame-pointer
build:asan --linkopt -fsanitize=address

1 change: 0 additions & 1 deletion .github/workflows/verible-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,6 @@ jobs:
mode:
- test
- smoke-test
- asan
- asan-clang
- compile
- compile-clang
Expand Down
35 changes: 35 additions & 0 deletions WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -199,3 +199,38 @@ http_archive(
strip_prefix = "bazel-compilation-database-ace73b04e76111afa09934f8771a2798847e724e",
urls = ["https://github.com/grailbio/bazel-compilation-database/archive/ace73b04e76111afa09934f8771a2798847e724e.tar.gz"],
)

# Toolchain that we use for sanitizer runs in the CI
http_archive(
name = "com_grail_bazel_toolchain",
sha256 = "77c368349e1a90e6e133c7a16743c622856a0e6b4c9935d7d40ece53cf9d3576",
strip_prefix = "bazel-toolchain-7e7c7cf1f965f348861085183d79b6a241764390",
urls = ["https://github.com/grailbio/bazel-toolchain/archive/7e7c7cf1f965f348861085183d79b6a241764390.tar.gz"],
)

load("@com_grail_bazel_toolchain//toolchain:deps.bzl", "bazel_toolchain_dependencies")

bazel_toolchain_dependencies()

load("@com_grail_bazel_toolchain//toolchain:rules.bzl", "llvm_toolchain")

llvm_toolchain(
name = "sanitizer_toolchain",
llvm_version = "10.0.1",
sha256 = {
"linux": "02a73cfa031dfe073ba8d6c608baf795aa2ddc78eed1b3e08f3739b803545046",
},
strip_prefix = {
"linux": "clang+llvm-10.0.1-x86_64-pc-linux-gnu",
},
urls = {
"linux": [
# Use a custom built Clang+LLVM binrary distribution that is more portable than
# the official builds because it's built against an older glibc and does not have
# dynamic library dependencies to tinfo, gcc_s or stdlibc++.
#
# For more details, see the files under toolchains/clang.
"https://github.com/retone/deps/releases/download/na5/clang+llvm-10.0.1-x86_64-pc-linux-gnu.tar.xz",
],
},
)

0 comments on commit 6af6c24

Please sign in to comment.