#!/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); } "--gc-sections" => {} "-Wl,--gc-sections" | "-Wl,--no-gc-sections" => {} _ if arg.starts_with("-T") => {} _ if arg.starts_with("-z") => {} _ if arg.starts_with("--script=") => {} _ => { args.push(arg); } } } Command::new("ld").args(&args).status().unwrap(); }