From: Dario Nieuwenhuis Date: Thu, 20 May 2021 19:50:50 +0000 (+0200) Subject: Add unstable docs for `cargo:rustc-link-arg-bin=foo=--bar` X-Git-Url: https://git.proxmox.com/?a=commitdiff_plain;h=daffd0a42bb1513cd72b2db6cc5443f6344f47af;p=cargo.git Add unstable docs for `cargo:rustc-link-arg-bin=foo=--bar` --- diff --git a/src/doc/src/reference/unstable.md b/src/doc/src/reference/unstable.md index 348936aba..e4befbccd 100644 --- a/src/doc/src/reference/unstable.md +++ b/src/doc/src/reference/unstable.md @@ -137,11 +137,13 @@ Cargo _or_ Rust features can be used. * Tracking Issue: [#9426](https://github.com/rust-lang/cargo/issues/9426) * Original Pull Request: [#7811](https://github.com/rust-lang/cargo/pull/7811) -The `-Z extra-link-arg` flag makes the following two instructions available +The `-Z extra-link-arg` flag makes the following instructions available in build scripts: * [`cargo:rustc-link-arg-bins=FLAG`](#rustc-link-arg-bins) – Passes custom flags to a linker for binaries. +* [`cargo:rustc-link-arg-bin=BIN=FLAG`](#rustc-link-arg-bin) – Passes custom + flags to a linker for the binary `BIN`. * [`cargo:rustc-link-arg=FLAG`](#rustc-link-arg) – Passes custom flags to a linker for benchmarks, binaries, `cdylib` crates, examples, and tests. @@ -155,6 +157,16 @@ to set a linker script or other linker options. [link-arg]: ../../rustc/codegen-options/index.md#link-arg + +#### `cargo:rustc-link-arg-bin=BIN=FLAG` + +The `rustc-link-arg-bin` instruction tells Cargo to pass the [`-C +link-arg=FLAG` option][link-arg] to the compiler, but only when building +the binary target with name `BIN`. Its usage is highly platform specific. It is useful +to set a linker script or other linker options. + +[link-arg]: ../../rustc/codegen-options/index.md#link-arg + #### `cargo:rustc-link-arg=FLAG`