I would like to dynamically create a set of labels in an assembly function using a gas macro. I would like to do something like this:
.macro set_up_jumptab_entry prefix, from=0, to=10
.quad \prefix_\item
.if \to-\from
set_up_jumptab_entry \prefix,"(\from+1)",\to
.endif
.endm
set_up_jumptab_entry myfunc 0 10
Here \prefix_\item would be something like myfunction_7. Now, I can find lots of examples of recursive invocation, but I haven’t found one of just label concatenation involving passed-in macro arguments. Gas is quite poorly documented, so answering this question is difficult for me.
- Can you concatenate arguments to macros with other tokens to make single tokens?
- What’s your favorite gas assembler reference?
things like
should create a label composed by argA and argB.
EDIT
Testing,
\()seems to be not necessary; the test code was:which is just
gcc -S test.coutput (lazyness:D) of a minimal C code. (provameanstestin italian)