[MC assembler] unexpected behavior of labels in nested macros

Dear LLVM Community,

I am currently facing an issue with the expansion of nested macros, using local labels. Considering the following example, in which a macro PARENT invokes its DAUGHTER macro:

.macro PARENT

jmp 1f // jump to local label 1

DAUGHTER

1:

.endmacro

.macro DAUGHTER

jmp 1f // jump to local label 1

1:

.endmacro

PARENT

The label used by the jmp instruction of DAUGHTER is the one defined in PARENT, which is not what I expect:

llvm-mc -arch=x86 -show-encoding < test.asm:

jmp .Ltmp0 # encoding: [0xeb,A]

fixup A - offset: 1, value: .Ltmp0-1, kind: FK_PCRel_1

jmp .Ltmp0 # encoding: [0xeb,A]

fixup A - offset: 1, value: .Ltmp0-1, kind: FK_PCRel_1

.Ltmp0:

.Ltmp1:

This issue is part of the generic MC implementation, as I could reproduce the same behavior for different target architecture (the example above is x86).

Is this a known issue ? Is there any workaround for this problem ?

Thanks in advance,

Best regards,

Cédric