Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 14 additions & 3 deletions packages/cli/src/build/request.rs
Original file line number Diff line number Diff line change
Expand Up @@ -726,9 +726,10 @@ impl BuildRequest {
BuildMode::Thin {
aslr_reference,
cache,
rustc_args,
..
} => {
self.write_patch(ctx, *aslr_reference, &mut artifacts, cache)
self.write_patch(ctx, *aslr_reference, &mut artifacts, cache, rustc_args)
.await?;
}

Expand Down Expand Up @@ -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
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)?;
Expand Down Expand Up @@ -1135,6 +1136,7 @@ impl BuildRequest {
aslr_reference: u64,
artifacts: &mut BuildArtifacts,
cache: &Arc<HotpatchModuleCache>,
rustc_args: &RustcArgs,
) -> Result<()> {
ctx.status_hotpatching();

Expand Down Expand Up @@ -1251,6 +1253,8 @@ impl BuildRequest {
.args(object_files.iter())
.args(self.thin_link_args(&args)?)
.args(out_arg)
.env_clear()
.envs(rustc_args.envs.iter().map(|(k, v)| (k, v)))
.output()
.await?;

Expand Down Expand Up @@ -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: 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();

let raw_args = std::fs::read_to_string(self.link_args_file.path())
Expand Down Expand Up @@ -1684,6 +1693,8 @@ impl BuildRequest {
let res = Command::new(linker)
.args(args.iter().skip(1))
.args(out_arg)
.env_clear()
.envs(rustc_args.envs.iter().map(|(k, v)| (k, v)))
.output()
.await?;

Expand Down
Loading