Dynamically create labels in gas macros?
Posted
by pgod
on Stack Overflow
See other posts from Stack Overflow
or by pgod
Published on 2010-06-07T14:36:05Z
Indexed on
2010/06/07
15:22 UTC
Read the original article
Hit count: 233
Hi everyone,
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?
© Stack Overflow or respective owner