Respect RUSTC_LINK_STD_INTO_RUSTC_DRIVER=0 in link_std_into_rustc_driver#153409
Respect RUSTC_LINK_STD_INTO_RUSTC_DRIVER=0 in link_std_into_rustc_driver#153409DeepeshWR wants to merge 1 commit intorust-lang:mainfrom
Conversation
|
r? @jieyouxu rustbot has assigned @jieyouxu. Use Why was this reviewer chosen?The reviewer was selected based on:
|
This comment has been minimized.
This comment has been minimized.
429e4bc to
0d326ff
Compare
This comment has been minimized.
This comment has been minimized.
0d326ff to
168c019
Compare
This comment has been minimized.
This comment has been minimized.
Allow users to opt out of statically linking std into rustc_driver by setting RUSTC_LINK_STD_INTO_RUSTC_DRIVER=0. If unset or set to any other value, the function falls back to the default, linking std into rustc_driver on all platforms except Windows. Signed-off-by: Deepesh Varatharajan <Deepesh.Varatharajan@windriver.com>
168c019 to
b8b260f
Compare
|
This should probably be an option in bootstrap.toml rather than an env var.
The existing env var is just an implementation detail of how the main bootstrap executable and the rustc wrapper of bootstrap communicate. |
Hi @bjorn3, Is this what you were suggesting ? |
|
What is the motivation for the override of the default logic? |
Hi @Mark-Simulacrum , The main motivation is to allow builders to explicitly control whether This became important when running ./x.py test for cross targets Currently, this behavior is controlled only by the platform check |
Rustc has always been dynamically linking rustc_driver.so. It can't be statically linked without breaking custom codegen backends. What other kinds of patches have you been applying to statically link rustc_driver? |
Just to clarify, I’m not referring to the actual The change we’re discussing affects the For example: Before the commit: After the commit: Since |
|
rustc_main doesn't contain any test code. Just skip it. Or you could probably add |
|
(Since you're already looking at it) |
Starting from Rust 1.82, std is statically linked with rustc_driver.so. This change affected the runtime dependencies of the rustc_main test binary, causing tests to fail in QEMU because librustc_driver*.so is not shipped and cannot be found. After discussing with upstream, the patch is removed, and the test is skipped using #[cfg(not(test))]. The rustc_main function does not include any test code,so this safely restores the feature without impacting tests. Upstream Discussion: rust-lang/rust#153409 Signed-off-by: Deepesh Varatharajan <Deepesh.Varatharajan@windriver.com> Signed-off-by: Mathieu Dubois-Briand <mathieu.dubois-briand@bootlin.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
|
Seems like this needs some work (or maybe isn't needed at all?) per comments, so setting to waiting on author @rustbot author |
|
Reminder, once the PR becomes ready for a review, use |
Starting from Rust 1.82, std is statically linked with rustc_driver.so. This change affected the runtime dependencies of the rustc_main test binary, causing tests to fail in QEMU because librustc_driver*.so is not shipped and cannot be found. After discussing with upstream, the patch is removed, and the test is skipped using #[cfg(not(test))]. The rustc_main function does not include any test code,so this safely restores the feature without impacting tests. Upstream Discussion: rust-lang/rust#153409 Signed-off-by: Deepesh Varatharajan <Deepesh.Varatharajan@windriver.com> Signed-off-by: Mathieu Dubois-Briand <mathieu.dubois-briand@bootlin.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Starting from Rust 1.82, std is statically linked with rustc_driver.so. This change affected the runtime dependencies of the rustc_main test binary, causing tests to fail in QEMU because librustc_driver*.so is not shipped and cannot be found. After discussing with upstream, the patch is removed, and the test is skipped using #[cfg(not(test))]. The rustc_main function does not include any test code,so this safely restores the feature without impacting tests. Upstream Discussion: rust-lang/rust#153409 Signed-off-by: Deepesh Varatharajan <Deepesh.Varatharajan@windriver.com> Signed-off-by: Mathieu Dubois-Briand <mathieu.dubois-briand@bootlin.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This patch allows users to opt out of statically linking std into rustc_driver by setting the existing environment variable
RUSTC_LINK_STD_INTO_RUSTC_DRIVER=0.If the variable is unset or set to any other value, the function falls back to the default behavior (linking std on all platforms except Windows).
Note: This does not introduce a new environment variable; it only respects an existing one.
Defaults remain unchanged, so normal builds are unaffected.
Example usage: