[sledge] Use standard "libFuzzer" name

Summary:
Trivial renamings to use the standard "libFuzzer" name instead of "lib
fuzzer".

Reviewed By: kren1

Differential Revision: D16067881

fbshipit-source-id: 3ff2a8f86
master
Josh Berdine 5 years ago committed by Facebook Github Bot
parent 13dac07361
commit 4c6ea0c887

@ -47,7 +47,7 @@ Analyze code in a buck target. This is a convenience wrapper for the sequence `s
[-bound <int>] stop execution exploration at depth <int> [-bound <int>] stop execution exploration at depth <int>
[-function-summaries] use function summaries (in development) [-function-summaries] use function summaries (in development)
[-lib-fuzzer] add a harness for lib fuzzer binaries [-fuzzer] add a harness for libFuzzer targets
[-llair-output <file>] write generated LLAIR to <file> [-llair-output <file>] write generated LLAIR to <file>
[-modules <file>] write list of bitcode files to <file>, or to standard [-modules <file>] write list of bitcode files to <file>, or to standard
output if <file> is `-` output if <file> is `-`
@ -85,7 +85,7 @@ Link code in a buck target to a single LLVM bitcode module. This also internaliz
=== flags === === flags ===
-bitcode-output <file> write linked bitcode to <file> -bitcode-output <file> write linked bitcode to <file>
[-lib-fuzzer] add a harness for lib fuzzer binaries [-fuzzer] add a harness for libFuzzer targets
[-modules <file>] write list of bitcode files to <file>, or to standard [-modules <file>] write list of bitcode files to <file>, or to standard
output if <file> is `-` output if <file> is `-`
[-trace <spec>] enable debug tracing [-trace <spec>] enable debug tracing
@ -120,7 +120,7 @@ Analyze code in one or more LLVM bitcode files. This is a convenience wrapper fo
[-bound <int>] stop execution exploration at depth <int> [-bound <int>] stop execution exploration at depth <int>
[-function-summaries] use function summaries (in development) [-function-summaries] use function summaries (in development)
[-lib-fuzzer] add a harness for lib fuzzer binaries [-fuzzer] add a harness for libFuzzer targets
[-llair-output <file>] write generated LLAIR to <file> [-llair-output <file>] write generated LLAIR to <file>
[-skip-throw] do not explore past throwing an exception [-skip-throw] do not explore past throwing an exception
[-trace <spec>] enable debug tracing [-trace <spec>] enable debug tracing
@ -138,7 +138,7 @@ Translate one or more LLVM bitcode files to LLAIR. Each <input> filename may be
=== flags === === flags ===
[-lib-fuzzer] add a harness for lib fuzzer binaries [-fuzzer] add a harness for libFuzzer targets
[-llair-output <file>] write generated LLAIR to <file> [-llair-output <file>] write generated LLAIR to <file>
[-trace <spec>] enable debug tracing [-trace <spec>] enable debug tracing
[-help] print this help text and exit [-help] print this help text and exit

@ -1395,8 +1395,8 @@ let link_in : Llvm.llcontext -> Llvm.lllinker -> string -> unit =
|> |>
[%Trace.retn fun {pf} _ -> pf ""] [%Trace.retn fun {pf} _ -> pf ""]
let translate : lib_fuzzer_harness:bool -> string list -> Llair.t = let translate ~fuzzer : string list -> Llair.t =
fun ~lib_fuzzer_harness inputs -> fun inputs ->
[%Trace.call fun {pf} -> [%Trace.call fun {pf} ->
pf "%a" (List.pp "@ " Format.pp_print_string) inputs] pf "%a" (List.pp "@ " Format.pp_print_string) inputs]
; ;
@ -1409,7 +1409,7 @@ let translate : lib_fuzzer_harness:bool -> string list -> Llair.t =
in in
Llvm_irreader.parse_ir llcontext model_memorybuffer Llvm_irreader.parse_ir llcontext model_memorybuffer
in in
( if lib_fuzzer_harness then ( if fuzzer then
let lib_fuzzer_memorybuffer = let lib_fuzzer_memorybuffer =
Llvm.MemoryBuffer.of_string Llvm.MemoryBuffer.of_string
(Option.value_exn (Model.read "/lib_fuzzer_main.bc")) (Option.value_exn (Model.read "/lib_fuzzer_main.bc"))

@ -9,6 +9,6 @@
exception Invalid_llvm of string exception Invalid_llvm of string
val translate : lib_fuzzer_harness:bool -> string list -> Llair.t val translate : fuzzer:bool -> string list -> Llair.t
(** Translate the compilation units in the named (llvm or bitcode) files to (** Translate the compilation units in the named (llvm or bitcode) files to
LLAIR. Attempts to raise [Invalid_llvm] when the input is invalid LLVM. *) LLAIR. Attempts to raise [Invalid_llvm] when the input is invalid LLVM. *)

@ -88,11 +88,11 @@ let translate =
let%map_open llair_output = let%map_open llair_output =
flag "llair-output" (optional string) flag "llair-output" (optional string)
~doc:"<file> write generated LLAIR to <file>" ~doc:"<file> write generated LLAIR to <file>"
and lib_fuzzer_harness = and fuzzer =
flag "lib-fuzzer" no_arg ~doc:"add a harness for lib fuzzer binaries" flag "fuzzer" no_arg ~doc:"add a harness for libFuzzer targets"
in in
fun bitcode_inputs () -> fun bitcode_inputs () ->
let program = Frontend.translate ~lib_fuzzer_harness bitcode_inputs in let program = Frontend.translate ~fuzzer bitcode_inputs in
Option.iter ~f:(marshal program) llair_output ; Option.iter ~f:(marshal program) llair_output ;
program program

@ -141,12 +141,12 @@ let bitcode_files_of ~target =
List.map ~f:(make_absolute (Lazy.force buck_root)) modules List.map ~f:(make_absolute (Lazy.force buck_root)) modules
(* link and optimize the modules *) (* link and optimize the modules *)
let llvm_link_opt ~lib_fuzzer_harness ~bitcode_output modules = let llvm_link_opt ~fuzzer ~bitcode_output modules =
let context = context () in let context = context () in
let modules = if lib_fuzzer_harness then "-" :: modules else modules in let modules = if fuzzer then "-" :: modules else modules in
let open Process in let open Process in
eval ~context eval ~context
( ( if lib_fuzzer_harness then ( ( if fuzzer then
echo ~n:() (Option.value_exn (Model.read "/lib_fuzzer_main.bc")) echo ~n:() (Option.value_exn (Model.read "/lib_fuzzer_main.bc"))
else return () ) else return () )
|- run |- run
@ -219,11 +219,10 @@ let main ~(command : unit Command.basic_command) ~analyze =
let%map_open bitcode_output = let%map_open bitcode_output =
flag "bitcode-output" (required abs_path_arg) flag "bitcode-output" (required abs_path_arg)
~doc:"<file> write linked bitcode to <file>" ~doc:"<file> write linked bitcode to <file>"
and lib_fuzzer_harness = and fuzzer =
flag "lib-fuzzer" no_arg flag "fuzzer" no_arg ~doc:"add a harness for libFuzzer targets"
~doc:"add a harness for lib fuzzer binaries"
in in
fun () -> llvm_link_opt ~lib_fuzzer_harness ~bitcode_output fun () -> llvm_link_opt ~fuzzer ~bitcode_output
in in
let param = bitcode_inputs |**> link in let param = bitcode_inputs |**> link in
command ~summary ~readme param command ~summary ~readme param

Loading…
Cancel
Save