[PATCH] D84363: [XCOFF][AIX] Handle llvm.used and llvm.compiler.used global array
Jason Liu via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Jul 23 14:27:49 PDT 2020
jasonliu marked an inline comment as done.
jasonliu added inline comments.
================
Comment at: llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp:1682
+static bool isSpecialLLVMGlobalArrayToSkip(const GlobalVariable *GV) {
+ return GV->hasAppendingLinkage() &&
+ StringSwitch<bool>(GV->getName())
----------------
DiggerLin wrote:
> not sure llvm.global_ctors must have an appending Linkage or not, I can not any information that talk about the llvm.global_ctors must having an appending Linkage.
> in the
> https://llvm.org/docs/LangRef.html , I can find the description as "
> The @llvm.used global is an array which has appending linkage. "
>
> and
> "appending
> “appending” linkage may only be applied to global variables of pointer to array type. When two global variables with appending linkage are linked together, the two global arrays are appended together. This is the LLVM, typesafe, equivalent of having the system linker append together “sections” with identical names when .o files are linked"
>
> but not for the llvm.global_ctors
>
>
I did a search for llvm.global_ctors and llvm.global_dtors in clang's unit test, and found all the occurrence of those are with appending linkage. And in my rough look up in the code, I don't find anything that could generate those variable with another linkage. So I think it's safe to assume these special global variables all have appending linkage. I don't really see a reason for those special global variables not to have an appending linkage. If there is a potential reason for them to not have that linkage, I could remove this quick escape path.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D84363/new/
https://reviews.llvm.org/D84363
More information about the llvm-commits
mailing list