diff options
| author | bors <bors@rust-lang.org> | 2021-05-06 15:19:39 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2021-05-06 15:19:39 +0000 |
| commit | d44f647ffcff0e1ff2c0f45b6a0ce9796d80f1ca (patch) | |
| tree | 11e72654b4a65b93a5c4249357b092a0c4293f26 /src/doc | |
| parent | 109248a4eb99bc83684c94ca4ef36f2fadc17e2a (diff) | |
| parent | ccc820e1f8eb8d8d142bd93d578bb5c7d9bb6775 (diff) | |
| download | rust-d44f647ffcff0e1ff2c0f45b6a0ce9796d80f1ca.tar.gz rust-d44f647ffcff0e1ff2c0f45b6a0ce9796d80f1ca.zip | |
Auto merge of #84982 - Dylan-DPC:rollup-q4cbec2, r=Dylan-DPC
Rollup of 8 pull requests
Successful merges:
- #83507 (Implement RFC 2951: Native link modifiers)
- #84328 (Stablize {HashMap,BTreeMap}::into_{keys,values})
- #84712 (Simplify chdir implementation and minimize unsafe block)
- #84851 (:arrow_up: rust-analyzer)
- #84923 (Only compute Obligation `cache_key` once in `register_obligation_at`)
- #84945 (E0583: Include secondary path in error message)
- #84949 (Fix typo in `MaybeUninit::array_assume_init` safety comment)
- #84950 (Revert PR 83866)
Failed merges:
r? `@ghost`
`@rustbot` modify labels: rollup
Diffstat (limited to 'src/doc')
5 files changed, 86 insertions, 0 deletions
diff --git a/src/doc/unstable-book/src/language-features/native-link-modifiers-as-needed.md b/src/doc/unstable-book/src/language-features/native-link-modifiers-as-needed.md new file mode 100644 index 00000000000..1757673612c --- /dev/null +++ b/src/doc/unstable-book/src/language-features/native-link-modifiers-as-needed.md @@ -0,0 +1,18 @@ +# `native_link_modifiers_as_needed` + +The tracking issue for this feature is: [#81490] + +[#81490]: https://github.com/rust-lang/rust/issues/81490 + +------------------------ + +The `native_link_modifiers_as_needed` feature allows you to use the `as-needed` modifier. + +`as-needed` is only compatible with the `dynamic` and `framework` linking kinds. Using any other kind will result in a compiler error. + +`+as-needed` means that the library will be actually linked only if it satisfies some undefined symbols at the point at which it is specified on the command line, making it similar to static libraries in this regard. + +This modifier translates to `--as-needed` for ld-like linkers, and to `-dead_strip_dylibs` / `-needed_library` / `-needed_framework` for ld64. +The modifier does nothing for linkers that don't support it (e.g. `link.exe`). + +The default for this modifier is unclear, some targets currently specify it as `+as-needed`, some do not. We may want to try making `+as-needed` a default for all targets. diff --git a/src/doc/unstable-book/src/language-features/native-link-modifiers-bundle.md b/src/doc/unstable-book/src/language-features/native-link-modifiers-bundle.md new file mode 100644 index 00000000000..ac192cff13a --- /dev/null +++ b/src/doc/unstable-book/src/language-features/native-link-modifiers-bundle.md @@ -0,0 +1,19 @@ +# `native_link_modifiers_bundle` + +The tracking issue for this feature is: [#81490] + +[#81490]: https://github.com/rust-lang/rust/issues/81490 + +------------------------ + +The `native_link_modifiers_bundle` feature allows you to use the `bundle` modifier. + +Only compatible with the `static` linking kind. Using any other kind will result in a compiler error. + +`+bundle` means objects from the static library are bundled into the produced crate (a rlib, for example) and are used from this crate later during linking of the final binary. + +`-bundle` means the static library is included into the produced rlib "by name" and object files from it are included only during linking of the final binary, the file search by that name is also performed during final linking. + +This modifier is supposed to supersede the `static-nobundle` linking kind defined by [RFC 1717](https://github.com/rust-lang/rfcs/pull/1717). + +The default for this modifier is currently `+bundle`, but it could be changed later on some future edition boundary. diff --git a/src/doc/unstable-book/src/language-features/native-link-modifiers-verbatim.md b/src/doc/unstable-book/src/language-features/native-link-modifiers-verbatim.md new file mode 100644 index 00000000000..02bd87e5095 --- /dev/null +++ b/src/doc/unstable-book/src/language-features/native-link-modifiers-verbatim.md @@ -0,0 +1,20 @@ +# `native_link_modifiers_verbatim` + +The tracking issue for this feature is: [#81490] + +[#81490]: https://github.com/rust-lang/rust/issues/81490 + +------------------------ + +The `native_link_modifiers_verbatim` feature allows you to use the `verbatim` modifier. + +`+verbatim` means that rustc itself won't add any target-specified library prefixes or suffixes (like `lib` or `.a`) to the library name, and will try its best to ask for the same thing from the linker. + +For `ld`-like linkers rustc will use the `-l:filename` syntax (note the colon) when passing the library, so the linker won't add any prefixes or suffixes as well. +See [`-l namespec`](https://sourceware.org/binutils/docs/ld/Options.html) in ld documentation for more details. +For linkers not supporting any verbatim modifiers (e.g. `link.exe` or `ld64`) the library name will be passed as is. + +The default for this modifier is `-verbatim`. + +This RFC changes the behavior of `raw-dylib` linking kind specified by [RFC 2627](https://github.com/rust-lang/rfcs/pull/2627). The `.dll` suffix (or other target-specified suffixes for other targets) is now added automatically. +If your DLL doesn't have the `.dll` suffix, it can be specified with `+verbatim`. diff --git a/src/doc/unstable-book/src/language-features/native-link-modifiers-whole-archive.md b/src/doc/unstable-book/src/language-features/native-link-modifiers-whole-archive.md new file mode 100644 index 00000000000..4961e88cad1 --- /dev/null +++ b/src/doc/unstable-book/src/language-features/native-link-modifiers-whole-archive.md @@ -0,0 +1,18 @@ +# `native_link_modifiers_whole_archive` + +The tracking issue for this feature is: [#81490] + +[#81490]: https://github.com/rust-lang/rust/issues/81490 + +------------------------ + +The `native_link_modifiers_whole_archive` feature allows you to use the `whole-archive` modifier. + +Only compatible with the `static` linking kind. Using any other kind will result in a compiler error. + +`+whole-archive` means that the static library is linked as a whole archive without throwing any object files away. + +This modifier translates to `--whole-archive` for `ld`-like linkers, to `/WHOLEARCHIVE` for `link.exe`, and to `-force_load` for `ld64`. +The modifier does nothing for linkers that don't support it. + +The default for this modifier is `-whole-archive`. diff --git a/src/doc/unstable-book/src/language-features/native-link-modifiers.md b/src/doc/unstable-book/src/language-features/native-link-modifiers.md new file mode 100644 index 00000000000..fc8b5754621 --- /dev/null +++ b/src/doc/unstable-book/src/language-features/native-link-modifiers.md @@ -0,0 +1,11 @@ +# `native_link_modifiers` + +The tracking issue for this feature is: [#81490] + +[#81490]: https://github.com/rust-lang/rust/issues/81490 + +------------------------ + +The `native_link_modifiers` feature allows you to use the `modifiers` syntax with the `#[link(..)]` attribute. + +Modifiers are specified as a comma-delimited string with each modifier prefixed with either a `+` or `-` to indicate that the modifier is enabled or disabled, respectively. The last boolean value specified for a given modifier wins. |
