|
| 1 | +# ******************************************************************************* |
| 2 | +# Copyright (c) 2026 Contributors to the Eclipse Foundation |
| 3 | +# |
| 4 | +# See the NOTICE file(s) distributed with this work for additional |
| 5 | +# information regarding copyright ownership. |
| 6 | +# |
| 7 | +# This program and the accompanying materials are made available under the |
| 8 | +# terms of the Apache License Version 2.0 which is available at |
| 9 | +# https://www.apache.org/licenses/LICENSE-2.0 |
| 10 | +# |
| 11 | +# SPDX-License-Identifier: Apache-2.0 |
| 12 | +# ******************************************************************************* |
| 13 | + |
| 14 | +load("@rules_cc//cc/toolchains:args.bzl", "cc_args") |
| 15 | +load("@rules_cc//cc/toolchains:feature.bzl", "cc_feature") |
| 16 | + |
| 17 | +# Link flags for ASan + UBSan + LSan combined |
| 18 | +cc_args( |
| 19 | + name = "asan_ubsan_lsan_link_args", |
| 20 | + actions = [ |
| 21 | + "@rules_cc//cc/toolchains/actions:cpp_link_executable", |
| 22 | + "@rules_cc//cc/toolchains/actions:cpp_link_dynamic_library", |
| 23 | + "@rules_cc//cc/toolchains/actions:cpp_link_nodeps_dynamic_library", |
| 24 | + ], |
| 25 | + args = [ |
| 26 | + "-fsanitize=undefined,address,leak", |
| 27 | + "-fsanitize-link-c++-runtime", |
| 28 | + ], |
| 29 | + visibility = ["//visibility:public"], |
| 30 | +) |
| 31 | + |
| 32 | +cc_feature( |
| 33 | + name = "asan_ubsan_lsan_link", |
| 34 | + feature_name = "asan_ubsan_lsan_link", |
| 35 | + args = [":asan_ubsan_lsan_link_args"], |
| 36 | + visibility = ["//visibility:public"], |
| 37 | +) |
| 38 | + |
| 39 | +# Link flags for ThreadSanitizer |
| 40 | +cc_args( |
| 41 | + name = "tsan_link_args", |
| 42 | + actions = [ |
| 43 | + "@rules_cc//cc/toolchains/actions:cpp_link_executable", |
| 44 | + "@rules_cc//cc/toolchains/actions:cpp_link_dynamic_library", |
| 45 | + "@rules_cc//cc/toolchains/actions:cpp_link_nodeps_dynamic_library", |
| 46 | + ], |
| 47 | + args = [ |
| 48 | + "-fsanitize=thread", |
| 49 | + "-fsanitize-link-c++-runtime", |
| 50 | + ], |
| 51 | + visibility = ["//visibility:public"], |
| 52 | +) |
| 53 | + |
| 54 | +cc_feature( |
| 55 | + name = "tsan_link", |
| 56 | + feature_name = "tsan_link", |
| 57 | + args = [":tsan_link_args"], |
| 58 | + visibility = ["//visibility:public"], |
| 59 | +) |
0 commit comments