Modify ↓
Ticket #17 (new defect)
%assign does not support $
| Reported by: | jlawson-yasm@… | Owned by: | peter@… |
|---|---|---|---|
| Priority: | P2 | Milestone: | 1.0.0 |
| Component: | Preprocessor: 'real' NASM | Version: | other |
| Severity: | normal | Keywords: | rthml tab space editor js |
| Cc: |
Description (last modified by peter@…) (diff)
The "$" operator (current assembly position) cannot be used in expressions for the %assign directive. This was seen in YASM version 0.3.0 (Note that your Bugzilla version table dropdown does not list 0.3.0 yet) For example this fails with "`$' not supported": %assign ual ($-startseg) mov eax,ual But this succeeds: mov eax,($-startseg) I've tried this in "-p nasm -r nasm" and also without any -p or -r options.
Attachments
Change History
comment:2 Changed 7 years ago by peter@…
- Owner changed from mu@… to peter@…
- Component changed from preprocessor: nasm-compatible to preprocessor: 'real' nasm
0.3.0 uses the real NASM preprocessor... and this bug was a crash workaround until I figured out a better way to handle this. As a workaround, use EQU for the test case given. The major difficulty here is for the %assign .... %if situation (e.g. you %assign with a $ expression and then test that asssignment). Because YASM only preprocesses and parses a file once before passing the parsed result onto the later assembly stages, whereas NASM parsed a file once, ran it all the way through the assembler to determine offsets of jump targets, then re-parsed (and re-preprocessed) the file to generate the output, the YASM preprocessor cannot know the output addresses (e.g. $) whereas the NASM preprocessor can. Thus, while it may be not too hard to support this particular testcases' usage, not all usages of $ in %assign will be able to be supported without significant impact to the overall design of YASM: multiple parses, or the slightly more preferable (but still difficult to implement) option of pushing back %if decisions to the output stage.
Note: See
TracTickets for help on using
tickets.
