[PATCH] D30129: Fix asm printing of associated sections

Rafael Avila de Espindola via llvm-commits llvm-commits at lists.llvm.org
Tue Feb 21 13:55:26 PST 2017


>> Why do you need both? Every section has a symbol associated with it, so
>> you could use the section symbol for the relocation section link to the
>> relocated section too.
>
> Because the section symbol can be redefined. For example, in
>
> .section x1,"a", at progbits
> .local  x1
> .comm   x1,4,4
>
> for section "x1", getBeginSymbol()->getSection() points to .bss.
> Is that a bug, btw? We could replace getBeginSymbol() with an unnamed
> symbol when it is redefined, but then there would be no way to
> represent it in textual assembly.

Yes, we should probably change this.

My personal preference would be to just error in assembly if the name is
reused (pr31850). If we can't do that and the non-section symbol has to
win, the hard case is

.section x1,"a", at progbits
.quad x1
.comm   x1,4,4

since the expression of .quad already points to the given symbol. What
needs to happen is for a new symbol to be created and be used as the
section symbol.

Cheers,
Rafael


More information about the llvm-commits mailing list