From f7617c1cd4d1910613ffecdfd8de28889002f6cc Mon Sep 17 00:00:00 2001 From: zetanumbers Date: Wed, 29 Nov 2023 02:13:58 -0800 Subject: Enable link-arg link kind inside of #[link] attribute - Implement link-arg as an attribute - Apply suggestions from review - Co-authored-by: Vadim Petrochenkov - Add unstable book entry --- .../src/language-features/link-arg-attribute.md | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 src/doc/unstable-book/src/language-features/link-arg-attribute.md (limited to 'src') diff --git a/src/doc/unstable-book/src/language-features/link-arg-attribute.md b/src/doc/unstable-book/src/language-features/link-arg-attribute.md new file mode 100644 index 00000000000..09915a7f274 --- /dev/null +++ b/src/doc/unstable-book/src/language-features/link-arg-attribute.md @@ -0,0 +1,21 @@ +# `link_arg_attribute` + +The tracking issue for this feature is: [#99427] + +------ + +The `link_arg_attribute` feature allows passing arguments into the linker +from inside of the source code. Order is preserved for link attributes as +they were defined on a single extern block: + +```rust,no_run +#![feature(link_arg_attribute)] + +#[link(kind = "link-arg", name = "--start-group")] +#[link(kind = "static", name = "c")] +#[link(kind = "static", name = "gcc")] +#[link(kind = "link-arg", name = "--end-group")] +extern "C" {} +``` + +[#99427]: https://github.com/rust-lang/rust/issues/99427 -- cgit 1.4.1-3-g733a5