|
From: | Nick Clifton |
Subject: | Re: gas: additional macro functionality (patch attached) |
Date: | Fri, 31 Aug 2007 16:12:31 +0100 |
User-agent: | Thunderbird 1.5.0.10 (X11/20070301) |
Hi Olaf,
I missed the possibility to referencea) the individual invocation count of each macro and b) the previous invocation count for each macro.
Actually this can be done using the current macro features of gas.
Problem: I need to build a single linked list at assemble time. This is traditionally done with somethink like:.set LINK, 0 .macro HEAD foo, bar ... .word LINK .set LINK,. .endm This does not work with gas assembling msp430 code on a PPC Mac, becauseLINK only gets resoved at relocation time, so all LINK fields are the same :-(
Ah, but that is because you are setting LINK to the value of "." which is the location counter which needs to be resolved at link time. If instead you use a static count for the macro then you can achieve the results you want. Like this:
.set LINK, 0 .macro HEAD .word LINK .set LINK, LINK + 1 .endmYou can also use expressions like "(LINK +1)" and "(LINK - 1)" to get the next and previous invocation counts.
Cheers Nick
[Prev in Thread] | Current Thread | [Next in Thread] |