[gas] Label inside macro
David Daney
ddaney@caviumnetworks.com
Wed Jun 8 19:33:00 GMT 2011
On 06/08/2011 12:00 PM, Robert Uhl wrote:
> Hi,
>
> I wrote the following macro and use it 256 times with the
> parameter intnr 0...255.
>
>
> .macro SPRINGBOARD intnr
> cmpq $0, (counter_running)
> je dont_count # interrupt counter disabled
>
> push $\intnr
> call countinterrupt
> add $8, %rsp # remove intnr from stack
>
> dont_count:
> jmp *(originalhandler + \intnr * 8)
> .align 16
> .endm
>
>
> Of course gas complains about the label dont_count:
> "Error: symbol `dont_count' is already defined".
>
> Is it possible to make the label only visible inside the macro?
> Or is it possible to use the parameter as a label inside the macro?
>
> I tried already "dont_count_\intr:" and "dont_count_\intr :" as a label
> but gas shows: "Error: invalid character '(' in mnemonic"
>
Look at:
http://sourceware.org/binutils/docs-2.21/as/Symbol-Names.html
Under the 'Local Labels' section, it explains how to do what you want.
David Daney
More information about the Binutils
mailing list