You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Tracking Issue for linking modifiers for native libraries #81490
This is a tracking issue for the RFC "Linking modifiers for native libraries" (rust-lang/rfcs#2951) accepted through MCP rust-lang/compiler-team#356.
The feature gate for the issue is #![feature(native_link_modifiers)].
About tracking issues
Tracking issues are used to record the overall progress of implementation.
They are also used as hubs connecting to other relevant issues, e.g., bugs or open design questions.
A tracking issue is however not meant for large scale discussion, questions, or bug reports about a feature.
Instead, open a dedicated issue for the specific matter and add the relevant feature gate label.
warning: the feature `native_link_modifiers` is incomplete and may not be safe to use and/or cause compiler crashes
--> library/unwind/src/lib.rs:8:12
|
8 | #![feature(native_link_modifiers)]
| ^^^^^^^^^^^^^^^^^^^^^
|
= note: `#[warn(incomplete_features)]` on by default
= note: see issue #81490 <https://github.com/rust-lang/rust/issues/81490> for more information
There are 4 feature gate: native_link_modifiers_{as_needed,bundle,verbatim,whole_archive}, are they both incomplete or just some of them are incomplete?
@petrochenkov Is there anything left before at least stabilizing the modifiers syntax (the native_link_modifiers feature)? If not I can help move that forward. It's definitely something we need to do before we stabilize any of the specific formats.
No, as far as I know (I wanted to audit the implementation once more though).
It probably makes sense to stabilize the syntax together with one of the specific modifiers, otherwise the stabilization is all the responsibility and none of the profits.
@petrochenkov I'm interested in helping out getting this stabilized if that's OK.
I'm hoping this RFC will help us improve Bazel Rust support.
I'm a novice with respect to rustc development.
What's left and what's the best way to get involved?
@krasimirgg
I actually just started auditing the implementation for stabilization today (the general modifier syntax, and the whole-archive modifier specifically). If no other task interrupts me, then I'll likely make a PR tomorrow.
The "relative order" part is entirely orthogonal though, so you can certainly work on that.
I remember starting implementing that and discovering that it is a more invasive change than I expected, so I abandoned it due to a lack of time, IIRC.
The code parsing these options (-l, -C link-arg and -C link-args) lives in compiler\rustc_session\src\options.rs and in compiler\rustc_session\src\config.rs.
It currently builds two separate option vectors - Options::libs and CodegenOptions::link_args, instead it needs to build a single vector for the both kinds of options that will then be used throughout the compiler.
So the stabilization of modifiers is orthogonal to the relative order fix?
Should we still reference the same RFC for the work?
Should we guard the new behavior of the relative order fix behind an experimental flag? Or see it as a bugfix and change the default behavior of the compiler?
@petrochenkov : Consider a case where an rlib depends on multiple native libraries, which themselves depend on each other, say rlib r depends on libnative1.a which itself depends on libnative2.a. My understanding is that while building r, we'll supply its native dependencies in the expected relative linker order, e.g., rustc -o r.rlib ... -lstatic:-bundle=native1 -lstatic:-bundle=native2 ....
Later, when r is used to build a rust binary b, I'd expect that in the linker invocation constructed to build b, the relative order of native1 and native2 will be preserved. Does rustc guarantee that?
I'd expect that in the linker invocation constructed to build b, the relative order of native1 and native2 will be preserved. Does rustc guarantee that?
Yes, in practice.
See #96328 for some discussion about documenting it.
For "Unresolved Questions" I think there is still the matter of the default of the bundle link modifier and it's purpose and interaction with respect to whole-archive. The full cross-product of intended behaviors for (+/-whole-archive, +/-bundle, crate-type) is a little unclear to me and would ideally get documentation.
@dcsommer
This is already documented in beta/nightly docs - https://doc.rust-lang.org/beta/rustc/command-line-arguments.html
Except that the compatibility case for whole-archive is intentionally vague, and the restriction on +bundle,+whole-archive in rlibs in not documented because it's sort of an implementation deficiency that we are planning to fix (#99429).
Activity
Rollup merge of rust-lang#83507 - luqmana:native-link-modifiers, r=pe…
Rollup merge of rust-lang#83507 - luqmana:native-link-modifiers, r=pe…
12101111 commentedon May 23, 2021
There are 4 feature gate:
native_link_modifiers_{as_needed,bundle,verbatim,whole_archive}, are they both incomplete or just some of them are incomplete?petrochenkov commentedon May 23, 2021
I don't think the incomplete warning is correct, the modifiers are not yet stable, but they are complete enough.
Auto merge of rust-lang#85606 - 12101111:link_modifiers, r=petrochenkov
luqmana commentedon Sep 10, 2021
@petrochenkov Is there anything left before at least stabilizing the modifiers syntax (the
native_link_modifiersfeature)? If not I can help move that forward. It's definitely something we need to do before we stabilize any of the specific formats.petrochenkov commentedon Sep 10, 2021
No, as far as I know (I wanted to audit the implementation once more though).
It probably makes sense to stabilize the syntax together with one of the specific modifiers, otherwise the stabilization is all the responsibility and none of the profits.
krasimirgg commentedon Feb 10, 2022
@petrochenkov I'm interested in helping out getting this stabilized if that's OK.
I'm hoping this RFC will help us improve Bazel Rust support.
I'm a novice with respect to rustc development.
What's left and what's the best way to get involved?
Maybe: the Relative order of -l and -Clink-arg(s) options part of the RFC is not yet implemented: #83507 (comment). Is anyone working on it, otherwise does it sound reasonable for me to pick this up?
petrochenkov commentedon Feb 10, 2022
@krasimirgg
I actually just started auditing the implementation for stabilization today (the general modifier syntax, and the
whole-archivemodifier specifically). If no other task interrupts me, then I'll likely make a PR tomorrow.The "relative order" part is entirely orthogonal though, so you can certainly work on that.
I remember starting implementing that and discovering that it is a more invasive change than I expected, so I abandoned it due to a lack of time, IIRC.
The code parsing these options (
-l,-C link-argand-C link-args) lives incompiler\rustc_session\src\options.rsand incompiler\rustc_session\src\config.rs.It currently builds two separate option vectors -
Options::libsandCodegenOptions::link_args, instead it needs to build a single vector for the both kinds of options that will then be used throughout the compiler.hlopko commentedon Feb 11, 2022
I have a few clarifying questions if I may :)
So the stabilization of modifiers is orthogonal to the relative order fix?
Should we still reference the same RFC for the work?
Should we guard the new behavior of the relative order fix behind an experimental flag? Or see it as a bugfix and change the default behavior of the compiler?
Thanks!
petrochenkov commentedon Feb 11, 2022
@hlopko
No, probably not, I see it as a bugfix.See below.21 remaining items
krasimirgg commentedon May 9, 2022
@petrochenkov : Consider a case where an rlib depends on multiple native libraries, which themselves depend on each other, say rlib
rdepends onlibnative1.awhich itself depends onlibnative2.a. My understanding is that while buildingr, we'll supply its native dependencies in the expected relative linker order, e.g.,rustc -o r.rlib ... -lstatic:-bundle=native1 -lstatic:-bundle=native2 ....Later, when
ris used to build a rust binaryb, I'd expect that in the linker invocation constructed to buildb, the relative order ofnative1andnative2will be preserved. Does rustc guarantee that?petrochenkov commentedon May 9, 2022
@krasimirgg
Yes, in practice.
See #96328 for some discussion about documenting it.
Rollup merge of rust-lang#95818 - petrochenkov:stabundle, r=wesleywiser
Rollup merge of rust-lang#95818 - petrochenkov:stabundle, r=wesleywiser
Auto merge of rust-lang#95818 - petrochenkov:stabundle, r=wesleywiser
petrochenkov commentedon Jul 18, 2022
Closing this umbrella issue in favor of more specific issues for the remaining unstable and unimplemented pieces:
as-needed#99424verbatim#99425-llibrary options #99427whole-archiveand link timecfgare not supported on bundled static libraries #99429dcsommer commentedon Aug 2, 2022
For "Unresolved Questions" I think there is still the matter of the default of the
bundlelink modifier and it's purpose and interaction with respect towhole-archive. The full cross-product of intended behaviors for (+/-whole-archive, +/-bundle, crate-type) is a little unclear to me and would ideally get documentation.petrochenkov commentedon Aug 2, 2022
@dcsommer
This is already documented in beta/nightly docs - https://doc.rust-lang.org/beta/rustc/command-line-arguments.html
Except that the compatibility case for
whole-archiveis intentionally vague, and the restriction on+bundle,+whole-archivein rlibs in not documented because it's sort of an implementation deficiency that we are planning to fix (#99429).Rollup merge of rust-lang#104360 - petrochenkov:stabverb, r=TaKO8Ki
Rollup merge of #83507 - luqmana:native-link-modifiers, r=petrochenkov
Rollup merge of #83507 - luqmana:native-link-modifiers, r=petrochenkov