What's the best way to define local labels in an assembler macro?

R. Diez rdiezmail-binutils@yahoo.de
Mon Apr 30 11:54:00 GMT 2012


Hi all:

What's the best way to define local labels in an assembler macro?

I read the GNU Assembler manual, but I still cannot figure it out. Say you've got some complicated nested macros invocations like this:

  .macro MACRO_A

    local_label_1:
    local_label_2:

    MACRO_B local_label_2   // Passes one of the local labels down.

    jump local_label_1

  .endm

The questions are:

1) Defining a label like "1:" does not make it local to the macro, right?
2) Appending "$" to the macro name helps a little, but it still isn't watertight, is it?
3) Can pseudo-variable \@ help? How does it behave in nested macro invocation scenarios?
4) Is .altmacro and its "LOCAL xxx" syntax the only safe way?

Please copy me on the answers, as I'm not subscribed to this list.

Thanks in advance,
  rdiez



More information about the Binutils mailing list