diff options
author | Fabian Meumertzheim <fabian@meumertzhe.im> | 2022-02-06 18:10:56 +0100 |
---|---|---|
committer | Fabian Meumertzheim <fabian@meumertzhe.im> | 2022-02-09 18:16:45 +0100 |
commit | 6c4d22766e3026e6f970a4c17835c529f7a6a1a4 (patch) | |
tree | eed298477390db063b9947db54573fe462733b73 /third_party | |
parent | 70f4db399d9b5e7e9b1910bde403e67ee9857e91 (diff) | |
download | jazzer-api-6c4d22766e3026e6f970a4c17835c529f7a6a1a4.tar.gz |
Use LLVM's CMake C flags for libfuzzer
We were using the flags from a standalone build script for libFuzzer,
but should instead try to use the same set of flags as an LLVM release
would use.
Diffstat (limited to 'third_party')
-rw-r--r-- | third_party/libFuzzer.BUILD | 25 |
1 files changed, 18 insertions, 7 deletions
diff --git a/third_party/libFuzzer.BUILD b/third_party/libFuzzer.BUILD index e8559936..bdb0ee56 100644 --- a/third_party/libFuzzer.BUILD +++ b/third_party/libFuzzer.BUILD @@ -1,4 +1,3 @@ -# Based on https://github.com/llvm/llvm-project/blob/llvmorg-11.1.0/compiler-rt/lib/fuzzer/build.sh cc_library( name = "libFuzzer", srcs = glob([ @@ -8,17 +7,29 @@ cc_library( "*.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, |