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 into
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>
Rust Changes: https://github.com/rust-lang/rust/releases/tag/1.95.0 Cargo Changes: https://doc.rust-lang.org/nightly/cargo/CHANGELOG.html#cargo-195-2026-04-16 Drop merged patches: 0001-Adjust-loongarch-assembly-test.patch 0001-Fix-flaky-assertions-in-oneshot-tests.patch 0001-Update-amdgpu-data-layout.patch Updated patches: 0001-src-core-build_steps-tool.rs-switch-off-lto-for-rust.patch rust-oe-selftest.patch New patch: 0002-Fix-rust-build-failure-with-unstable-options.patch Fix rust build failure with unstable options. Remove the check that errors out when -Zunstable-options is not provided for custom targets.The original upstream change (and its follow-up) mainly ensured GitHub workflows and tests work correctly by explicitly passing "-Zunstable-options", along with related testcase updates. Reverting the entire commit would also undo those unrelated workflow and test adjustments, so this patch only targets the specific enforcement logic without affecting the rest of the changes. rust-lang/rust#155963 Selftest Changes: Skip two failing tests src/librustdoc src/tools/rustdoc rust-lang/rust#153409 Excluded tests: +--------+----------+---------+ | Before | After | Skipped | +---------+---------+---------+ | 37 | 39 | +2 | +--------+----------+---------+ Test results: rust v1.95.0 +-------------+---------+---------+ | Machine | Passed | Skipped | +-------------+---------+---------+ | qemux86-64 | 22187 | 689 | | qemux86 | 21929 | 947 | | qemuarm64 | 21994 | 882 | | qemuarm | 21910 | 966 | | qemuriscv64 | 21955 | 921 | +-------------+---------+---------+ Test results difference (1.95.0 - 1.94.1): +-------------+--------+---------+ | Machine | Passed | Skipped | +-------------+--------+---------+ | qemux86-64 | +276 | +29 | | qemux86 | +271 | +34 | | qemuarm64 | +271 | +34 | | qemuarm | +271 | +34 | | qemuriscv64 | +270 | +35 | +-------------+--------+---------+ 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: