Using label in macro
Nick Clifton
nickc@redhat.com
Fri Oct 18 11:36:00 GMT 2002
Hi Martin,
> Martin Bian <martin@utstar.com> writes:
>
> Hello all, I want to use macro in my assemble language
> source code. But I need a label in one of line include the
> macro.
> Who can tell me how to make a macro to implement it?
: Ben Elliston <bje@redhat.com> writes:
:
: How about this example?
:
: .macro foo arg
: \arg:
: nop
: .endm
:
: .text
: foo bar
Alternatively if the label is only ever defined and referenced inside
the macro you can use local labels like this:
.macro foo
99:
NOP
BNE 99b
.endm
Of course this does not work if you want to nest the macro, or if you
are going to use the local label '99' somewhere else in your assembler
source, where it could span an invocation of the macro.
Cheers
Nick
More information about the Binutils
mailing list