Yes, it is. What you've indicated (.finished$
) works perfectly.
EDIT: Well, I was completely wrong. Sorry for misleading people looking for answers.
From what I understand of your question, you need local labels in GNU as
. As far as I know, that's not possible.
Label collisions are only found in the same source file. If you separated every function (which is the only situation this can fix) from the original source file, then it would work. If they're all within one function, you're done. This seems to be the best and most manageable solution from pure assembly.
Otherwise, you could use local symbols (not labels, see comments) like .L<function_id>_<local_label>
, where the .L
ensures that it's file-local, but I generally dislike it. It does, however, require extra typing.
In case, however, you can do most of the work in C and use the GNU extended assembler, the GNU extended assembly page notes that within the AssemblyTemplate, you have this option:
Special format strings
[...]
'%='
Outputs a number that is unique to each instance of the asm statement in the entire compilation. This option is useful when creating local labels and referring to them multiple times in a single template that generates multiple assembler instructions.
From that, you could use labels like .%=labelname:
from within GNU inline assembler and it will be work. Even then, what are you trying to accomplish? There is probably a better way somewhere.