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) |
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: