flat assembler
Message board for the users of flat assembler.
Index
> Compiler Internals > [SOLVED] [fasm2] Problem with labels and namespace |
| Author |
|
|
Jessé 22 Jun 2026, 00:59
To better illustrate the problem, it also happens if pure binary is used:
Code: use64 Start: jmp .next .next: mov eax, 231 xor edi, edi syscall Quote:
Also important: fasm1 can compile this code properly (the binary), without modifications: Quote:
|
|||
|
|
Tomasz Grysztar 22 Jun 2026, 04:58
This is an old flaw that I could not consistently fix before I had the context-preserving option for macro arguments. I should have fixed this when I introduced the & prefix for arguments. But better late than never, I'm fixing it now.
|
|||
|
|
Tomasz Grysztar 22 Jun 2026, 05:22
To clarify what made me not fix it in the old days while I was aware of the problem: even with fasmg updating the label base properly, it would get broken by any macro that would intercept the entire line with label, like this one:
Code: macro ? line&
line
end macro But with the & prefix now available, any such macro can be made safe: Code: macro ? &line& line end macro Code: macro Start any& match : instruction, any Start: instruction ; this has the context kept from the macro call else err 'unexpected instruction' end match end macro Code: macro Start &any& match : instruction, any Start: instruction else err 'unexpected instruction' end match end macro |
|||
|
|
Jessé 22 Jun 2026, 23:23
I tested it, and it worked perfectly, at the samples provided, showing off the expected behavior.
Now I need to review some parts of my codes because, I must admit, I sometimes neglect (forget) the '&' as a prefix, even though I know and knew what it does. And that code is quite "old", assuming that I did it not know enough about fasmg language, and never reviewed it in deep detail afterwards. Thanks a lot for the quick reply. |
|||
|
|
Jessé 23 Jun 2026, 07:37
With some minor tweaks here and there (i.e., mostly by using '&' prefix wherever needed), I have managed to even get this unusual usage case to work properly after this fix.
Line 22 (the '_code' line with marks the entry point) is what made me realize that there might be a problem with labels. |
|||
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2026, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.