[PATCH] D75305: [AIX] Handle LinkOnceODRLinkage and llvm.global_ctors/dtors' AppendingLinkage

Xiangling Liao via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Mar 2 07:14:10 PST 2020


Xiangling_L marked 4 inline comments as done.
Xiangling_L added inline comments.


================
Comment at: llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp:1952
+  case GlobalValue::AppendingLinkage:
+    llvm_unreachable("Should never emit it.");
   default:
----------------
hubert.reinterpretcast wrote:
> As it stands, users can pass in IR with such linkage. This should be `report_fatal_error` because this is indeed reachable without being a clear bug elsewhere.
> 
> As for the text, it should say something like `"There is no mapping that implements AppendingLinkage for XCOFF."`
Thank you, I will update it.


================
Comment at: llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp:1589
+  return StringSwitch<bool>(GV->getName())
+      .Cases("llvm.global_ctors", "llvm.global_dtors", true)
+      .Default(false);
----------------
hubert.reinterpretcast wrote:
> This list does not match `AsmPrinter::EmitSpecialLLVMGlobal`. I do not believe this function as it is named and implemented is okay.
Thank you for pointing this out. 


> This list does not match `AsmPrinter::EmitSpecialLLVMGlobal`

This is because I am thinking to limit the scope of current `AppendingLinkage` work to LNT test, where all `AppendingLinkage`failures are related to static init related `llvm.global_ctors` global array. Do you prefer to cover all `AppendingLinkage` related global arrays in this patch instead?



> I do not believe this function as it is named and implemented is okay.

Yes, you are right. Probably the `isSpecialLLVMGlobal` is misleading, cuz this function doesn't cover all LLVM global symbols. Would `isSpecialStaticInitGlobalArrays` or `isSpecialAIXStaticInitGlobalArrays` be better? Or do you have any other suggestions?

As for the implementation,  general LLVM implementation of `AsmPrinter::EmitSpecialLLVMGlobal` doesn't emit what we want for `llvm.global_ctors` and `llvm.global_dtors` on AIX. Since our initial patch of static init doesn't support `-qtwolink` similar behavior, we don't need to emit anything from these two arrays. 







Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D75305





More information about the llvm-commits mailing list