Skip to content

Commit

Permalink
Update brioche-ld to get the linker path by appending -orig to it…
Browse files Browse the repository at this point in the history
…self
  • Loading branch information
kylewlacy committed Jan 3, 2025
1 parent 4c24ca9 commit 0503c5c
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions crates/brioche-ld/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ fn main() -> ExitCode {

fn run() -> eyre::Result<ExitCode> {
let current_exe = std::env::current_exe().context("failed to get current executable")?;
let current_exe_name = current_exe
.file_name()
.ok_or_eyre("failed to get current executable name")?;
let current_exe_dir = current_exe
.parent()
.ok_or_eyre("failed to get current executable dir")?;
Expand All @@ -39,7 +42,10 @@ fn run() -> eyre::Result<ExitCode> {
);
}

let linker = ld_resource_dir.join("ld");
let mut original_exe_name = current_exe_name.to_owned();
original_exe_name.push("-orig");
let original_exe = current_exe.with_file_name(&original_exe_name);

let packed_path = ld_resource_dir.join("brioche-packed");

let mut output_path = PathBuf::from("a.out");
Expand Down Expand Up @@ -98,7 +104,7 @@ fn run() -> eyre::Result<ExitCode> {
Ok("true")
);

let mut command = std::process::Command::new(linker);
let mut command = std::process::Command::new(&original_exe);
command.args(std::env::args_os().skip(1));
let status = command.status()?;

Expand Down

0 comments on commit 0503c5c

Please sign in to comment.