From 83670aee223a5b7e8b1eb196e2f6b8635b99ed3f Mon Sep 17 00:00:00 2001 From: Miquel Sabaté Solà Date: Tue, 28 Apr 2026 13:33:23 +0200 Subject: nasm: add the --split-segments option MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This allows the programmer to tell nasm to leave each segment into its own .out file. This can be useful when writing some specific segments into different chips. The caveat is that filling is not applied, and hence it's up to the programmer to account for that if two or more segments happened to be on the same mapping and needed some alignment in between. Signed-off-by: Miquel Sabaté Solà --- lib/xixanta/src/assembler.rs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'lib/xixanta/src') diff --git a/lib/xixanta/src/assembler.rs b/lib/xixanta/src/assembler.rs index 7e5ff90..e36136e 100644 --- a/lib/xixanta/src/assembler.rs +++ b/lib/xixanta/src/assembler.rs @@ -1301,7 +1301,16 @@ impl<'a> Assembler<'a> { global: true, }); } - res.append(&mut segment.bundles); + + // The cheapest thing to do would be to call append(), but that + // would remove all the elements from 'segment.bundles' and + // that's not what we want in case the user wants to then + // retrieve the bundles for each specific segment (e.g. the + // '--split-segments' option on nasm). Hence, just go and copy + // everything. Even if that's theoretically expensive it + // shouldn't be that big of a deal considering the amount of + // data we are moving here in the end. + res.extend_from_slice(&segment.bundles); } let mut diff = mapping.size as isize - mapping.offset as isize; -- cgit v1.2.3