1load("@fmeum_rules_jni//jni:defs.bzl", "cc_jni_library") 2 3cc_jni_library( 4 name = "native_asan", 5 srcs = [ 6 "com_example_ExampleFuzzerWithNative.cpp", 7 ], 8 copts = [ 9 "-fsanitize=fuzzer-no-link,address", 10 "-fno-sanitize-blacklist", 11 ], 12 linkopts = select({ 13 "//:clang_on_linux": ["-fuse-ld=lld"], 14 "@platforms//os:windows": [ 15 # Windows requires all symbols that should be imported from the main 16 # executable to be defined by an import lib. 17 "/wholearchive:clang_rt.asan_dll_thunk-x86_64.lib", 18 ], 19 "//conditions:default": [], 20 }), 21 visibility = ["//examples:__pkg__"], 22 deps = [ 23 "//examples:example_fuzzer_with_native_lib.hdrs", 24 ], 25) 26 27cc_jni_library( 28 name = "native_ubsan", 29 srcs = [ 30 "com_example_ExampleFuzzerWithNative.cpp", 31 ], 32 copts = [ 33 "-fsanitize=fuzzer-no-link,undefined", 34 "-fno-sanitize-recover=all", 35 ], 36 linkopts = select({ 37 "//:clang_on_linux": ["-fuse-ld=lld"], 38 "@platforms//os:windows": [ 39 # Using the asan thunk is correct here as it contains symbols for 40 # UBSan and SanCov as well. 41 "/wholearchive:clang_rt.asan_dll_thunk-x86_64.lib", 42 ], 43 "//conditions:default": [], 44 }), 45 visibility = ["//examples:__pkg__"], 46 deps = [ 47 "//examples:example_fuzzer_with_native_lib.hdrs", 48 ], 49) 50