[sledge] Define `sledge buck link` in terms of `sledge buck bitcode`

Summary: Defining link by composition inherits the flags of bitcode.

Reviewed By: kren1

Differential Revision: D16059777

fbshipit-source-id: c8f6b1d73
master
Josh Berdine 6 years ago committed by Facebook Github Bot
parent 26a34bc33c
commit 39fe848146

@ -84,11 +84,13 @@ Link code in a buck target to a single LLVM bitcode module. This also internaliz
=== flags ===
-output <file> write linked output to <file>
[-lib-fuzzer] add a harness for lib fuzzer binaries
[-trace <spec>] enable debug tracing
[-help] print this help text and exit
(alias: -?)
-output <file> write linked output to <file>
[-lib-fuzzer] add a harness for lib fuzzer binaries
[-output-modules <file>] write list of bitcode files to <file>, or to
standard output if <file> is `-`
[-trace <spec>] enable debug tracing
[-help] print this help text and exit
(alias: -?)
====== sledge llvm ======

@ -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:"<file> write linked output to <file>"
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

Loading…
Cancel
Save