This is the mail archive of the binutils@sourceware.org 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: macro's and local variables


>>> On 17.10.12 at 00:55, Ian Lance Taylor <iant@google.com> wrote:
> On Tue, Oct 16, 2012 at 11:37 AM, Mischa Baars <mjbaars1977@gmail.com> wrote:
>> However, I do not understand. Do you have an example?
> 
> 		.intel_syntax	noprefix
> 		.global		function
> 		.code64
> .macro		A		arg1
> 		.set		i\@, 0
> .rept		\arg1	
> 		mov		ax, i\@
> 		.set		i\@, i\@ + 1
> .endr
> .endm
> 
> .macro		C
> 		.set		i\@, 0
> .rept		4	
> 		A		i\@
> 		.set		i\@, i\@ + 1
> .endr
> .endm
> function:
> 		C	
> 		ret

Another option here is to use "local" (requiring .altmacro to be
in effect).

Jan


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