diff --git a/sledge/sledge-help.txt b/sledge/sledge-help.txt index ae600a9a0..21a8bf045 100644 --- a/sledge/sledge-help.txt +++ b/sledge/sledge-help.txt @@ -84,11 +84,13 @@ Link code in a buck target to a single LLVM bitcode module. This also internaliz === flags === - -output write linked output to - [-lib-fuzzer] add a harness for lib fuzzer binaries - [-trace ] enable debug tracing - [-help] print this help text and exit - (alias: -?) + -output write linked output to + [-lib-fuzzer] add a harness for lib fuzzer binaries + [-output-modules ] write list of bitcode files to , or to + standard output if is `-` + [-trace ] enable debug tracing + [-help] print this help text and exit + (alias: -?) ====== sledge llvm ====== diff --git a/sledge/src/sledge_buck.ml b/sledge/src/sledge_buck.ml index d54153e53..85b3a177e 100644 --- a/sledge/src/sledge_buck.ml +++ b/sledge/src/sledge_buck.ml @@ -165,7 +165,8 @@ let llvm_link_opt ~lib_fuzzer_harness ~output modules = open Command.Let_syntax -let ( |*> ) x f = x |> Command.Param.apply f +let ( |*> ) a' f' = a' |> Command.Param.apply f' +let ( |**> ) = Command.Param.map2 ~f:(fun a f b -> f b a) let abs_path_arg = Command.Param.(Arg_type.map string ~f:(make_absolute cwd)) @@ -214,18 +215,17 @@ let main ~(command : unit Command.basic_command) ~analyze = "Link code in a buck target to a single LLVM bitcode module. This \ also internalizes all symbols except `main` and removes dead code." in - let param = - let%map_open target = target_flag - and output = + let link = + let%map_open output = flag "output" (required abs_path_arg) ~doc:" write linked output to " and lib_fuzzer_harness = flag "lib-fuzzer" no_arg ~doc:"add a harness for lib fuzzer binaries" in - fun () -> - llvm_link_opt ~lib_fuzzer_harness ~output (bitcode_files_of ~target) + fun () -> llvm_link_opt ~lib_fuzzer_harness ~output in + let param = bitcode_inputs |**> link in command ~summary ~readme param in let summary = "integration with Buck" in