From a7bf22ce402256c3a056ac278629552ef4978da2 Mon Sep 17 00:00:00 2001 From: Miquel Sabaté Solà Date: Thu, 30 Apr 2026 12:21:20 +0200 Subject: nasm/xa65: add the --allow-unused option MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Since the addition of the check() function in commit 6a9dea943c07 ("Add a new 'check' stage in assemble()"), it can be annoying to some users that the check for unused/unreferenced object applies by default. Hence, add a flag so this can be disabled. Signed-off-by: Miquel Sabaté Solà --- crates/nasm/src/main.rs | 4 ++++ crates/xa65/src/main.rs | 6 ++++++ 2 files changed, 10 insertions(+) (limited to 'crates') diff --git a/crates/nasm/src/main.rs b/crates/nasm/src/main.rs index 6541d9c..b865fa7 100644 --- a/crates/nasm/src/main.rs +++ b/crates/nasm/src/main.rs @@ -21,6 +21,7 @@ struct Args { defines: Vec<(String, u8)>, asan: bool, info: bool, + allow_unused: bool, } // Print the help message and quit. @@ -29,6 +30,7 @@ fn print_help() { println!("usage: nasm [OPTIONS] \n"); println!("Options:"); println!(" -a, --asan\t\tEnable the Address Sanitizer."); + println!(" --allow-unused\t\tAllow unused .proc's or unreferenced objects."); println!(" -c, --config \tLinker configuration to be used, whether an identifier or a file path."); println!( " -D (=VALUE)\tDefine an 8-bit variable on the global scope ('VALUE' defaults to '1')" @@ -108,6 +110,7 @@ fn parse_arguments() -> Args { while let Some(arg) = args.next() { match arg.as_str() { "-a" | "--asan" => res.asan = true, + "--allow-unused" => res.allow_unused = true, "-c" | "--config" => match res.config { Some(_) => die("only specify the '-C/--config' flag once".to_string()), None => match args.next() { @@ -330,6 +333,7 @@ fn main() { args.config.unwrap_or("nrom".to_string()).as_str(), &args.defines, &source, + args.allow_unused, args.asan, ); diff --git a/crates/xa65/src/main.rs b/crates/xa65/src/main.rs index abf866b..77e5127 100644 --- a/crates/xa65/src/main.rs +++ b/crates/xa65/src/main.rs @@ -18,6 +18,7 @@ struct Args { no_errors: bool, strict: bool, stats: bool, + allow_unused: bool, } // Print the help message and quit. @@ -25,6 +26,7 @@ fn print_help() { println!("Bridge between 'nasm' and 'ca65'.\n"); println!("usage: xa65 [OPTIONS] \n"); println!("Options:"); + println!(" --allow-unused\tPass the '--allow-unused' flag to 'nasm'."); println!(" -b, --bin \tAlternative to the binary for 'nasm'."); println!(" -C, --config \tLinker configuration to be used, whether an identifier or a file path."); println!(" -h, --help\t\tPrint this message."); @@ -48,6 +50,7 @@ fn parse_arguments() -> Args { while let Some(arg) = args.next() { match arg.as_str() { + "--allow-unused" => res.allow_unused = true, "-b" | "--bin" => match res.bin { Some(_) => die("only specify the '-b/--bin' flag once".to_string()), None => match args.next() { @@ -263,6 +266,9 @@ fn main() { if args.stats { cmd.arg("--stats"); } + if args.allow_unused { + cmd.arg("--allow-unused"); + } // Actually run the command. match cmd.status() { -- cgit v1.2.3