[PATCH] D76932: [AIX] emit .extern and .weak directive linkage

Hubert Tong via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Apr 17 14:37:18 PDT 2020


hubert.reinterpretcast added inline comments.


================
Comment at: llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp:2144
     report_fatal_error(
-        "Unhandled linkage when mapping linkage to StorageClass.");
+        "AvailableExternallyLinkage is for its first instance of linkage");
   }
----------------
It seems my editing instruction got confused for the text. This is what I meant:
```
"Unhandled AvailableExternallyLinkage when mapping linkage to StorageClass"
```


================
Comment at: llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp:1641
 
-  // External global variables are already handled.
-  if (GV->isDeclaration())
+  if (GV->isDeclaration()) {
+    emitLinkage(GV, Csect->getQualNameSymbol());
----------------
DiggerLin wrote:
> hubert.reinterpretcast wrote:
> > This should probably be `isDeclarationForLinker`. It seems we need a larger followup for `AvailableExternallyLinkage` that would involve checking our calls to `isDeclaration`:
> > 
> > ```
> > define void @_Z1gv() {
> > entry:
> >   call void @_Z1fIiEvv()
> >   ret void
> > }
> > 
> > ; Function Attrs: inlinehint nounwind
> > define available_externally void @_Z1fIiEvv() #0 {
> > entry:
> >   ret void
> > }
> > 
> > attributes #0 = { inlinehint nounwind }
> > ```
> 
>    bool isDeclarationForLinker() const {
>      if (hasAvailableExternallyLinkage())
>        return true;
>  
>      return isDeclaration();
>    }
>  
> since we do not deal with AvailableExternallyLinkage in AsmPrinter::emitLinkage()
> 
> if change to isDeclarationForLinker here , it will hit a report_fatal_error.
What happens for the case above? We need to generate `MCSA_Extern` for the reference. The definition should not appear in the output.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D76932





More information about the cfe-commits mailing list