[PATCH] D78045: [XCOFF][AIX] Fix getSymbol to return the correct qualname when necessary

Jason Liu via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 16 11:41:46 PDT 2020


jasonliu marked an inline comment as done.
jasonliu added inline comments.


================
Comment at: llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp:1614
       OutStreamer->emitXCOFFLocalCommonSymbol(
-          GVSym, Size, Csect->getQualNameSymbol(), Align);
+          OutContext.getOrCreateSymbol(GVSym->getUnqualifiedName()), Size,
+          GVSym, Align);
----------------
DiggerLin wrote:
> jasonliu wrote:
> > hubert.reinterpretcast wrote:
> > > DiggerLin wrote:
> > > > since we have a qualname symbol, I do not think we need to create and unnecessary  UnqualifiedName symbol.
> > > > maybe we change change the interface of emitXCOFFLocalCommonSymbol. I do not think we need to pass two Symbols(MCSymbol *LabelSym,  and  MCSymbol *CsectSym) in the emitXCOFFLocalCommonSymbol.
> > > The label does not have to be given linkage, but it is not optional in the assembly syntax.
> > `.lcomm  a[BS],4,a[BS],2` does not work. First expression must be a label.  
> we can  change 
> 
> LabelSym->print(OS, MAI);
> 
> to 
> 
> OS << CsectSym->getUnqualifiedName();
> 
> in the function void MCAsmStreamer::emitXCOFFLocalCommonSymbol
I'd prefer to leave the interface as it is. The label and the csect does not necessarily have to be `.lcomm a, 4, a[BS],2`. It could be `.lcomm a, 4, b[BS],2'. 
In the future, if we need to do an assembly paser, we could receive the case like above, and need to have label and csect represented separately. 


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D78045/new/

https://reviews.llvm.org/D78045





More information about the llvm-commits mailing list