Skip to content

build: add support for Clang with Address Sanitizer. #265

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 9 commits into from
Feb 24, 2022
22 changes: 22 additions & 0 deletions .bazelrc
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,28 @@ build:clang --action_env=BAZEL_COMPILER=clang
build:clang --action_env=CC=clang
build:clang --action_env=CXX=clang++

# Use Clang compiler with Address and Undefined Behavior Sanitizers.
build:clang-asan --config=clang
build:clang-asan --copt -DADDRESS_SANITIZER=1
build:clang-asan --copt -DUNDEFINED_SANITIZER=1
build:clang-asan --copt -O1
build:clang-asan --copt -fno-omit-frame-pointer
build:clang-asan --copt -fno-optimize-sibling-calls
build:clang-asan --copt -fsanitize=address,undefined
build:clang-asan --copt -fsanitize-address-use-after-scope
build:clang-asan --linkopt -fsanitize=address,undefined
build:clang-asan --linkopt -fsanitize-address-use-after-scope
build:clang-asan --linkopt -fsanitize-link-c++-runtime
build:clang-asan --linkopt -fuse-ld=lld
build:clang-asan --test_env=ASAN_OPTIONS=check_initialization_order=1:detect_stack_use_after_return=1:strict_init_order=1:strict_string_checks=1
build:clang-asan --test_env=UBSAN_OPTIONS=halt_on_error=1:print_stacktrace=1
build:clang-asan --test_env=ASAN_SYMBOLIZER_PATH

# Use Clang compiler with Address and Undefined Behavior Sanitizers (strict version).
build:clang-asan-strict --config=clang-asan
build:clang-asan-strict --copt -fsanitize=integer
build:clang-asan-strict --linkopt -fsanitize=integer

# Use GCC compiler.
build:gcc --action_env=BAZEL_COMPILER=gcc
build:gcc --action_env=CC=gcc
Expand Down
21 changes: 21 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,12 @@ jobs:
arch: x86_64
action: test
flags: --config=gcc
- name: 'NullVM on Linux/x86_64 with ASan'
engine: 'null'
os: ubuntu-20.04
arch: x86_64
action: test
flags: --config=clang-asan-strict
- name: 'NullVM on Windows/x86_64'
engine: 'null'
os: windows-2019
Expand All @@ -109,6 +115,14 @@ jobs:
action: test
flags: --config=clang --define=crypto=system
cache: true
- name: 'V8 on Linux/x86_64 with ASan'
engine: 'v8'
repo: 'v8'
os: ubuntu-20.04
arch: x86_64
action: test
flags: --config=clang-asan
cache: true
- name: 'V8 on Linux/aarch64'
engine: 'v8'
repo: 'v8'
Expand Down Expand Up @@ -145,6 +159,13 @@ jobs:
arch: x86_64
action: test
flags: --config=clang
- name: 'Wasmtime on Linux/x86_64 with ASan'
engine: 'wasmtime'
repo: 'com_github_bytecodealliance_wasmtime'
os: ubuntu-20.04
arch: x86_64
action: test
flags: --config=clang-asan-strict
- name: 'Wasmtime on Linux/aarch64'
engine: 'wasmtime'
repo: 'com_github_bytecodealliance_wasmtime'
Expand Down