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

Jason Liu via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Apr 9 08:08:47 PDT 2020


jasonliu added inline comments.


================
Comment at: llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp:1497
+          OutContext.getOrCreateSymbol("." + Name->getName());
+      assert(FnEntryPointSym->getName().equals(
+                 cast<MCSymbolXCOFF>(FnEntryPointSym)->getUnqualifiedName()) &&
----------------
Based on our discussion, this assertion could be removed.
And please add a comment saying
// If there is a direct call to this extern function, we need to emit linkage for its function entry point symbol.


================
Comment at: llvm/test/CodeGen/PowerPC/aix-extern-weak.ll:11
+
+ at foo_ext_weak_p = global void (...)* bitcast (void ()* @foo_ext_weak to void (...)*)
+
----------------
hubert.reinterpretcast wrote:
> I would prefer to test the function call and the take-address-of-function cases separately here.
I think this is to test when the function is both taken address, and get called directly, will we emit linkage for both  function entry point and function descriptor symbol? The original implementation only emit one of them.
Maybe it makes sense to have a separate test case like this to test the linkage emit in all circumstance: 
```
void foo_called();
void foo_refed();
void foo_called_refed();

void (*foo_refed_p)() = foo_refed;
void (*foo_called_refed_p)() = foo_called_refed;

void bar(){
  foo_called();
  foo_called_refed();
}
```


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