diff options
| author | Miquel Sabaté Solà <mikisabate@gmail.com> | 2025-09-03 22:40:38 +0200 |
|---|---|---|
| committer | Miquel Sabaté Solà <mikisabate@gmail.com> | 2025-09-03 22:40:38 +0200 |
| commit | 112d5a7f51ea8f4d16b15032b2bdc5b9888d9372 (patch) | |
| tree | 8234be3061263466677c0c7b3fa7d8ad1ff42c1e /lib/xixanta/src | |
| parent | e0b1faf993bab97288540769f6f5f7955b3e0996 (diff) | |
| download | tools.nes-112d5a7f51ea8f4d16b15032b2bdc5b9888d9372.tar.gz tools.nes-112d5a7f51ea8f4d16b15032b2bdc5b9888d9372.zip | |
Apply asan:ignore also when bundling
This way instructions which might make use of bare memory numbers can
freely ignore the address sanitizer when it actually makes sense.
Signed-off-by: Miquel Sabaté Solà <mikisabate@gmail.com>
Diffstat (limited to 'lib/xixanta/src')
| -rw-r--r-- | lib/xixanta/src/assembler.rs | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/lib/xixanta/src/assembler.rs b/lib/xixanta/src/assembler.rs index 01a1982..28a2313 100644 --- a/lib/xixanta/src/assembler.rs +++ b/lib/xixanta/src/assembler.rs @@ -706,6 +706,7 @@ impl<'a> Assembler<'a> { fn bundle(&mut self, nodes: &'a [PNode]) -> Result<(), Vec<Error>> { let mut errors = Vec::new(); + let mut next_ignore = false; self.stage = Stage::Bundling; @@ -753,6 +754,10 @@ impl<'a> Assembler<'a> { self.bundle(args)?; } } + NodeType::Comment(CommentType::AsanIgnore) => { + next_ignore = true; + self.asan_next_ignore = true; + } NodeType::Instruction => { self.literal_mode = None; match self.evaluate_node(node) { @@ -810,6 +815,13 @@ impl<'a> Assembler<'a> { _ => {} } + + // Keep `self.asan_next_ignore` to false if possible. + if next_ignore { + next_ignore = false; + } else { + self.asan_next_ignore = false; + } } if errors.is_empty() { @@ -2543,7 +2555,7 @@ impl<'a> Assembler<'a> { // called by `jmp` or `jsr` kind of instructions on the absolute addressing // mode, as they operate on another level. fn asan_check_arm(&mut self, node: &PNode, value: &Bundle) -> Result<(), Error> { - if !self.asan_enabled { + if !self.asan_enabled || self.asan_next_ignore { return Ok(()); } |
