fix: use the rustc env for linking too, hopefully fixing windows (#4172)
This commit is contained in:
1 parent
8216e4f177
commit
d435f0084e
1 file changed
+14
-3
@@ -726,9 +726,10 @@ impl BuildRequest {
|
|||||||
BuildMode::Thin {
|
BuildMode::Thin {
|
||||||
aslr_reference,
|
aslr_reference,
|
||||||
cache,
|
cache,
|
||||||
|
rustc_args,
|
||||||
..
|
..
|
||||||
} => {
|
} => {
|
||||||
self.write_patch(ctx, *aslr_reference, &mut artifacts, cache)
|
self.write_patch(ctx, *aslr_reference, &mut artifacts, cache, rustc_args)
|
||||||
.await?;
|
.await?;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -892,7 +893,7 @@ impl BuildRequest {
|
|||||||
|
|
||||||
// Fat builds need to be linked with the fat linker. Would also like to link here for thin builds
|
// Fat builds need to be linked with the fat linker. Would also like to link here for thin builds
|
||||||
if matches!(ctx.mode, BuildMode::Fat) {
|
if matches!(ctx.mode, BuildMode::Fat) {
|
||||||
self.run_fat_link(ctx, &exe).await?;
|
self.run_fat_link(ctx, &exe, &direct_rustc).await?;
|
||||||
}
|
}
|
||||||
|
|
||||||
let assets = self.collect_assets(&exe, ctx)?;
|
let assets = self.collect_assets(&exe, ctx)?;
|
||||||
@@ -1135,6 +1136,7 @@ impl BuildRequest {
|
|||||||
aslr_reference: u64,
|
aslr_reference: u64,
|
||||||
artifacts: &mut BuildArtifacts,
|
artifacts: &mut BuildArtifacts,
|
||||||
cache: &Arc<HotpatchModuleCache>,
|
cache: &Arc<HotpatchModuleCache>,
|
||||||
|
rustc_args: &RustcArgs,
|
||||||
) -> Result<()> {
|
) -> Result<()> {
|
||||||
ctx.status_hotpatching();
|
ctx.status_hotpatching();
|
||||||
|
|
||||||
@@ -1251,6 +1253,8 @@ impl BuildRequest {
|
|||||||
.args(object_files.iter())
|
.args(object_files.iter())
|
||||||
.args(self.thin_link_args(&args)?)
|
.args(self.thin_link_args(&args)?)
|
||||||
.args(out_arg)
|
.args(out_arg)
|
||||||
|
.env_clear()
|
||||||
|
.envs(rustc_args.envs.iter().map(|(k, v)| (k, v)))
|
||||||
.output()
|
.output()
|
||||||
.await?;
|
.await?;
|
||||||
|
|
||||||
@@ -1500,7 +1504,12 @@ impl BuildRequest {
|
|||||||
///
|
///
|
||||||
/// todo: I think we can traverse our immediate dependencies and inspect their symbols, unless they `pub use` a crate
|
/// todo: I think we can traverse our immediate dependencies and inspect their symbols, unless they `pub use` a crate
|
||||||
/// todo: we should try and make this faster with memmapping
|
/// todo: we should try and make this faster with memmapping
|
||||||
pub(crate) async fn run_fat_link(&self, ctx: &BuildContext, exe: &Path) -> Result<()> {
|
pub(crate) async fn run_fat_link(
|
||||||
|
&self,
|
||||||
|
ctx: &BuildContext,
|
||||||
|
exe: &Path,
|
||||||
|
rustc_args: &RustcArgs,
|
||||||
|
) -> Result<()> {
|
||||||
ctx.status_starting_link();
|
ctx.status_starting_link();
|
||||||
|
|
||||||
let raw_args = std::fs::read_to_string(self.link_args_file.path())
|
let raw_args = std::fs::read_to_string(self.link_args_file.path())
|
||||||
@@ -1691,6 +1700,8 @@ impl BuildRequest {
|
|||||||
let res = Command::new(linker)
|
let res = Command::new(linker)
|
||||||
.args(args.iter().skip(1))
|
.args(args.iter().skip(1))
|
||||||
.args(out_arg)
|
.args(out_arg)
|
||||||
|
.env_clear()
|
||||||
|
.envs(rustc_args.envs.iter().map(|(k, v)| (k, v)))
|
||||||
.output()
|
.output()
|
||||||
.await?;
|
.await?;
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user