2024-05-14 19:06:04 +00:00
|
|
|
#!/usr/bin/env -S cargo +nightly -q -Zscript
|
|
|
|
|
|
|
|
use std::env;
|
|
|
|
use std::process::Command;
|
|
|
|
|
|
|
|
fn main() {
|
|
|
|
let mut args = vec![
|
|
|
|
"-e".to_string(), "_start".to_string(),
|
|
|
|
"-lSystem".to_string(),
|
|
|
|
"-L/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.4.sdk".to_string()
|
|
|
|
];
|
|
|
|
|
|
|
|
let mut argv: Vec<_> = env::args().skip(1).collect();
|
|
|
|
while argv.len() > 0 {
|
|
|
|
let arg = argv.remove(0);
|
|
|
|
match &*arg {
|
|
|
|
"-T" | "-z" => {
|
|
|
|
// Skip next one too
|
|
|
|
_ = argv.remove(0);
|
|
|
|
}
|
2024-05-15 10:19:36 +00:00
|
|
|
"--gc-sections" => {}
|
|
|
|
"-Wl,--gc-sections" | "-Wl,--no-gc-sections" => {}
|
|
|
|
_ if arg.starts_with("-T") => {}
|
|
|
|
_ if arg.starts_with("-z") => {}
|
|
|
|
_ if arg.starts_with("--script=") => {}
|
2024-05-14 19:06:04 +00:00
|
|
|
_ => {
|
|
|
|
args.push(arg);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Command::new("ld").args(&args).status().unwrap();
|
|
|
|
}
|