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

Jason Liu via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Apr 8 11:24:11 PDT 2020


jasonliu added inline comments.


================
Comment at: llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp:1500
+      if (cast<MCSymbolXCOFF>(Name)->hasContainingCsect())
+        emitLinkage(&F, Name);
+
----------------
DiggerLin wrote:
> jasonliu wrote:
> > 1. We need to rebase here, as it is called `hasRepresentedCsectSet()` instead of `hasContainingCsect()` now.
> > 2. I'm slightly worried here to rely on `hasRepresentedCsectSet()` to check if a linkage should be emitted. This is based on the assumption that we will not ever change our implementation for `.bl foo` to `.bl foo[PR]`. But in https://reviews.llvm.org/D77080#inline-706207, we discussed about this possibility. So this assumption might not be true in the future. However, I'm not sure if there is another way to check if this function have been called directly. 
> > So if there is another way to check, we should pursue the alternative instead. If there is not, then we need to add an assert here, like `assert(Name->getName().equals(cast<MCSymbolXCOFF>(Name)->getUnqualifiedName())` to make sure we don't get a qualname here. 
> > 3. 
> > Have a comment here and tell people what we are doing here.
> > For example, 
> > // If there is a direct call to external function, then we need to emit linkage for its function entry point. 
> when we implement .bl foo to .bl foo[PR]
> the SymbolName will change from .bl[SMC] and check the .bl[SMC]->hasRepresentedCsectSet()
Yes, but foo[PR]->hasRepresentedCsectSet() will always return true, because whenever we created a qualname will always have csect set. How will we know if foo() function is called directly then? 


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