diff options
Diffstat (limited to 'third_party/libFuzzer.BUILD')
-rw-r--r-- | third_party/libFuzzer.BUILD | 29 |
1 files changed, 20 insertions, 9 deletions
diff --git a/third_party/libFuzzer.BUILD b/third_party/libFuzzer.BUILD index e8559936..bf902f21 100644 --- a/third_party/libFuzzer.BUILD +++ b/third_party/libFuzzer.BUILD @@ -1,24 +1,35 @@ -# Based on https://github.com/llvm/llvm-project/blob/llvmorg-11.1.0/compiler-rt/lib/fuzzer/build.sh cc_library( - name = "libFuzzer", + name = "libfuzzer_no_main", srcs = glob([ "*.cpp", - ]), + ], exclude = ["FuzzerMain.cpp"]), hdrs = glob([ "*.h", "*.def", ]), - copts = select({ + copts = [ + # https://github.com/llvm/llvm-project/blob/eab395fa4074a5a0cbfebe811937dbb1816df9ef/compiler-rt/CMakeLists.txt#L294-L309 + "-fno-builtin", + "-fno-exceptions", + "-funwind-tables", + "-fno-stack-protector", + "-fno-sanitize=safe-stack", + "-fvisibility=hidden", + "-fno-lto", + ] + select({ "@platforms//os:windows": [ - "/Ox", # Optimize for speed. - "/Oy-", # Do not omit frame pointer. + # https://github.com/llvm/llvm-project/blob/eab395fa4074a5a0cbfebe811937dbb1816df9ef/compiler-rt/CMakeLists.txt#L362-L363 + "/Oy-", + "/GS-", "/std:c++17", ], "//conditions:default": [ - "-g", - "-O2", + # https://github.com/llvm/llvm-project/commit/29d3ba7576b30a37bd19a5d40f304fc39c6ab13d "-fno-omit-frame-pointer", - "-std=c++11", + # 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", ], }), alwayslink = True, |