This is the mail archive of the mailing list for the binutils project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [gas] Label inside macro

On Wednesday, June 08, 2011 15:00:13 Robert Uhl wrote:
> .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"

David pointed you at the right documentation, but i'll just post an answer 
since ive done more gas macro writing than i care to admit ...


and if that doesnt work, just use local labels like so:
	je 1f;

unless you have good reason for the symbols showing up in the compiled object, 
i'd suggest you use the latter anyways

Attachment: signature.asc
Description: This is a digitally signed message part.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]