github.com/prysmaticlabs/prysm@v1.4.4/third_party/afl/BUILD.bazel (about) 1 package( 2 default_testonly = True, 3 default_visibility = ["//visibility:public"], 4 ) 5 # Note: these libraries only compile with llvm. 6 7 cc_library( 8 name = "comm_hdr", 9 hdrs = [ 10 "alloc-inl.h", 11 "config.h", 12 "debug.h", 13 "hash.h", 14 "types.h", 15 ], 16 visibility = ["//visibility:private"], 17 ) 18 19 CFLAGS = [ 20 "-O3 -funroll-loops", 21 "-Wall -D_FORTIFY_SOURCE=2 -g -Wno-pointer-sign", 22 "-DAFL_PATH=\\\"/usr/local/lib/afl\\\"", 23 "-DDOC_PATH=\\\"/usr/local/share/doc/afl\\\"", 24 "-DBIN_PATH=\\\"/usr/local/bin\\\"", 25 ] 26 27 LDFLAGS = ["-ldl"] 28 29 cc_library( 30 name = "lib-afl-fuzz", 31 srcs = ["afl-fuzz.c"], 32 copts = CFLAGS, 33 linkopts = LDFLAGS, 34 visibility = ["//visibility:private"], 35 deps = [":comm_hdr"], 36 ) 37 38 cc_library( 39 name = "lib-afl-showmap", 40 srcs = ["afl-showmap.c"], 41 copts = CFLAGS, 42 linkopts = LDFLAGS, 43 visibility = ["//visibility:private"], 44 deps = [":comm_hdr"], 45 ) 46 47 cc_library( 48 name = "afl-llvm-rt", 49 srcs = ["llvm_mode/afl-llvm-rt.o.c"], 50 copts = ["-Wno-pointer-sign -O3"], 51 visibility = ["//visibility:private"], 52 deps = [":comm_hdr"], 53 ) 54 55 cc_library( 56 name = "fuzzing_engine", 57 srcs = ["afl_driver.cpp"], 58 copts = ["-fsanitize=address -O3"], 59 linkopts = ["-fsanitize=address"], 60 tags = ["manual"], 61 deps = [":afl-llvm-rt"], 62 ) 63 64 genrule( 65 name = "libs", 66 srcs = [ 67 ":lib-afl-fuzz", 68 ":lib-afl-showmap", 69 ], 70 outs = [ 71 "afl-fuzz", 72 "afl-showmap", 73 ], 74 cmd = """ 75 cp $(locations :lib-afl-fuzz) . 76 cp $(locations :lib-afl-showmap) . 77 mv liblib-afl-fuzz.a $(location afl-fuzz) 78 mv liblib-afl-showmap.a $(location afl-showmap) 79 """, 80 )