I ported some MASM code to NASM. The port was fairly painless, except for the need for local labels. The local labels were needed because the MASM code had multiple procedures, and some labels were common to the procedure. For example
;; MASM code
_FOO PROC
...
Exit_Failure:
...
Exit_Success:
...
ret
_FOO ENDP
_BAR PROC
...
Exit_Failure:
...
Exit_Success:
...
ret
_BAR ENDP
Under NASM, I have to use local labels. For example:
;; NASM code
global _FOO
section .text
_FOO:
...
.Exit_Failure:
...
.Exit_Success:
...
ret
When the code is assembled with debugging information, it produces labels that are eyesores (to me). The code will produce labels _FOO.Exit_Failure
, _FOO.Exit_Success
and so on. In addition to being an eyesore, they complicate porting because I have to add a dot to every label.
I can't seem to find NASM's notion of a "named" section of code so the label can be scoped.
How do I scope procedures to avoid the need for local labels?