* GAS - \@ in macros and labels
@ 2002-05-29 14:49 kieft_brian
2002-05-30 17:13 ` Scott Lanning
0 siblings, 1 reply; 3+ messages in thread
From: kieft_brian @ 2002-05-29 14:49 UTC (permalink / raw)
To: linux-assembly
I'm having a little trouble with specifying labels inside of two different
macros using the \@ variable. See the following...
.MACRO tableHdr someArgs
A_\@:
.DC.W (B_\@ - A_\@)
stuff....
.ENDM
.MACRO tableEnd someArgs
B_\@:
.ENDM
Unfortunately the number produced by \@ will never be in sync between the two
macros due to the fact that a new macro call will increment the counter (not to
mention that there may be some other macros called in between Hdr and End).
So I attempted to resolve the situation by creating my own variable...
.MACRO tableHdr someArgs
.SET CMD_NUM,\@
A_CMD_NUM:
.DC.W (B_CMD_NUM - A_CMD_NUM)
stuff....
.ENDM
.MACRO tableEnd someArgs
B_CMD_NUM:
.ENDM
Unfortunately GAS sees this as literal text and throws a bunch of "symbol
already defined" errors. Any ideas on how to make the CMD_NUM appear as its
value in a label? Thanks,
Brian
**********************************************************************
This e-mail and any files transmitted with it are confidential and may
be legally privileged or otherwise exempt from disclosure under
applicable law. This e-mail and its files are intended solely for
the individual or entity to whom they are addressed and their content
is the property of Smiths Aerospace. If you are not the intended
recipient, please do not read, copy, use or disclose this communication.
If you have received this e-mail in error please notify the e-mail
administrator at postmaster@si.com and then delete this e-mail, its
files and any copies.
This footnote also confirms that this e-mail message has been scanned
for the presence of known computer viruses.
***********************************************************************
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: GAS - \@ in macros and labels
2002-05-29 14:49 GAS - \@ in macros and labels kieft_brian
@ 2002-05-30 17:13 ` Scott Lanning
2002-05-30 22:44 ` h-peter recktenwald
0 siblings, 1 reply; 3+ messages in thread
From: Scott Lanning @ 2002-05-30 17:13 UTC (permalink / raw)
To: kieft_brian; +Cc: linux-assembly
On Wed, 29 May 2002 kieft_brian@si.com wrote:
> .MACRO tableHdr someArgs
> .SET CMD_NUM,\@
> A_CMD_NUM:
> .DC.W (B_CMD_NUM - A_CMD_NUM)
> stuff....
>
> .ENDM
>
> .MACRO tableEnd someArgs
> B_CMD_NUM:
> .ENDM
>
>
> Unfortunately GAS sees this as literal text and throws a bunch of "symbol
> already defined" errors. Any ideas on how to make the CMD_NUM appear as its
> value in a label? Thanks,
Please tell me if you figure it out. :)
In the meantime, I use `cpp`. Then you can use the concatenation
operator '##', like
#define tableHdr(cmd_num) A_ ## cmd_num:\
and so on..
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: GAS - \@ in macros and labels
2002-05-30 17:13 ` Scott Lanning
@ 2002-05-30 22:44 ` h-peter recktenwald
0 siblings, 0 replies; 3+ messages in thread
From: h-peter recktenwald @ 2002-05-30 22:44 UTC (permalink / raw)
To: Scott Lanning; +Cc: kieft_brian, linux-assembly
On Thu, 30 May 2002 13:13:25 -0400
Scott Lanning <slanning@theworld.com> wrote:
> On Wed, 29 May 2002 kieft_brian@si.com wrote:
> > .MACRO tableHdr someArgs
> > .SET CMD_NUM,\@
> > A_CMD_NUM:
> > .DC.W (B_CMD_NUM - A_CMD_NUM)
> > stuff....
> >
> > .ENDM
> >
> > .MACRO tableEnd someArgs
> > B_CMD_NUM:
> > .ENDM
> >
> >
> > Unfortunately GAS sees this as literal text and throws a bunch of "symbol
> > already defined" errors. Any ideas on how to make the CMD_NUM appear as its
> > value in a label? Thanks,
if you want to generate linked/chained lists, you could use 'local' (numeric)
labels, the range of which is far beyond the documented max. of 9. examples
can be found in the linux kernel (arch/i386/lib/checksum.S, macroes SRC, DST)
or, as aplied in "eForth" (http://www.lxhp.in-berlin.de/index-lx.shtml#e4)
regards,
hp
--
Linux,Assembly,Forth: http://www.lxhp.in-berlin.de/index-lx.shtml en/de
NO abusive software patents http://petition.eurolinux.org/pr/pr17.html
-
To unsubscribe from this list: send the line "unsubscribe linux-assembly" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2002-05-30 22:44 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-05-29 14:49 GAS - \@ in macros and labels kieft_brian
2002-05-30 17:13 ` Scott Lanning
2002-05-30 22:44 ` h-peter recktenwald
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.