aboutsummaryrefslogtreecommitdiff
path: root/third_party/libFuzzer.BUILD
blob: 5506af985ab96605aabd50ab858076ac10bed9f3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
cc_library(
    name = "libfuzzer_no_main",
    srcs = glob(
        [
            "*.cpp",
        ],
        exclude = ["FuzzerMain.cpp"],
    ),
    hdrs = glob([
        "*.h",
        "*.def",
    ]),
    copts = [
        # https://github.com/llvm/llvm-project/blob/eab395fa4074a5a0cbfebe811937dbb1816df9ef/compiler-rt/CMakeLists.txt#L294-L309
        "-fno-builtin",
        "-fno-exceptions",
        "-funwind-tables",
        "-fno-stack-protector",
        "-fvisibility=hidden",
        "-fno-lto",
    ] + select({
        "@platforms//os:windows": [
            # https://github.com/llvm/llvm-project/blob/eab395fa4074a5a0cbfebe811937dbb1816df9ef/compiler-rt/CMakeLists.txt#L362-L363
            "/Oy-",
            "/GS-",
            "/std:c++17",
        ],
        "//conditions:default": [
            # https://github.com/llvm/llvm-project/commit/29d3ba7576b30a37bd19a5d40f304fc39c6ab13d
            "-fno-omit-frame-pointer",
            # https://github.com/llvm/llvm-project/blob/eab395fa4074a5a0cbfebe811937dbb1816df9ef/compiler-rt/CMakeLists.txt#L392
            "-O3",
            # Use the same C++ standard as Jazzer itself.
            "-std=c++17",
        ],
    }),
    linkstatic = True,
    visibility = ["//visibility:public"],
    alwayslink = True,
)