From fdfc017b68a397fc2a1c02378a6c86ca7966954d Mon Sep 17 00:00:00 2001 From: Miquel Sabaté Solà Date: Thu, 30 Apr 2026 13:14:51 +0200 Subject: nasm: add documentation to the 'unused' checks MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Miquel Sabaté Solà --- crates/nasm/README.md | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'crates') diff --git a/crates/nasm/README.md b/crates/nasm/README.md index d61c84e..355b28b 100644 --- a/crates/nasm/README.md +++ b/crates/nasm/README.md @@ -246,6 +246,29 @@ fit in a byte. Hence, you could have a code like follows: If you compile the code with `-D PAL=1`, then the first branch will be taken instead of the second one. +### Unused code + +This assembler will also issue a warning whenever it finds unreferenced +variables or labels. Hence, if you have something like: + +```asm +foo: + rts + +;; code that never references 'foo'. +``` + +Then you will get: + +``` +warning: raw address 'foo' is unused (unused.s) +``` + +In the case for subroutines defined via `.proc`, this warning will actually be +an error, as `nasm` can rightly identify that this is dead code. + +This check can be skipped by providing the `--allow-unused` flag on nasm. + ## Address sanitizer This assembler comes with a set of tools that builds up an "address -- cgit v1.2.3