diff options
author | jasonliu <jasonliu.development@gmail.com> | 2019-11-26 16:05:26 +0000 |
---|---|---|
committer | jasonliu <jasonliu.development@gmail.com> | 2019-11-26 16:09:31 +0000 |
commit | 7707d8aa9db8aa3814593f9c40cc707f306e3ae2 (patch) | |
tree | 1f9a518fdcbf406b2952ca61694a469879dc2966 /llvm/lib/Target/PowerPC/PPCISelLowering.cpp | |
parent | 008e65a7bfb320bf197a04ff6427da84f8d38b76 (diff) | |
download | bcm5719-llvm-7707d8aa9db8aa3814593f9c40cc707f306e3ae2.tar.gz bcm5719-llvm-7707d8aa9db8aa3814593f9c40cc707f306e3ae2.zip |
[XCOFF][AIX] Check linkage on the function, and two fixes for comments
This is a follow up commit to address post-commit comment in D70443
Differential revision: https://reviews.llvm.org/D70443
Diffstat (limited to 'llvm/lib/Target/PowerPC/PPCISelLowering.cpp')
-rw-r--r-- | llvm/lib/Target/PowerPC/PPCISelLowering.cpp | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/llvm/lib/Target/PowerPC/PPCISelLowering.cpp b/llvm/lib/Target/PowerPC/PPCISelLowering.cpp index f95f8be8a04..3c59cea7f96 100644 --- a/llvm/lib/Target/PowerPC/PPCISelLowering.cpp +++ b/llvm/lib/Target/PowerPC/PPCISelLowering.cpp @@ -52,6 +52,7 @@ #include "llvm/CodeGen/SelectionDAGNodes.h" #include "llvm/CodeGen/TargetInstrInfo.h" #include "llvm/CodeGen/TargetLowering.h" +#include "llvm/CodeGen/TargetLoweringObjectFileImpl.h" #include "llvm/CodeGen/TargetRegisterInfo.h" #include "llvm/CodeGen/ValueTypes.h" #include "llvm/IR/CallSite.h" @@ -5326,16 +5327,19 @@ SDValue PPCTargetLowering::FinishCall( GlobalAddressSDNode *G = cast<GlobalAddressSDNode>(Callee); auto &Context = DAG.getMachineFunction().getMMI().getContext(); + const GlobalObject *GO = cast<GlobalObject>(G->getGlobal()); MCSymbolXCOFF *S = cast<MCSymbolXCOFF>(Context.getOrCreateSymbol( - Twine(".") + Twine(G->getGlobal()->getName()))); - - const GlobalValue *GV = G->getGlobal(); - if (GV && GV->isDeclaration() && !S->hasContainingCsect()) { - // On AIX, undefined symbol need to associate with a MCSectionXCOFF to - // get the correct storage mapping class. In this case, XCOFF::XMC_PR. + Twine(".") + Twine(GO->getName()))); + + if (GO && GO->isDeclaration() && !S->hasContainingCsect()) { + // On AIX, an undefined symbol needs to be associated with a + // MCSectionXCOFF to get the correct storage mapping class. + // In this case, XCOFF::XMC_PR. + const XCOFF::StorageClass SC = + TargetLoweringObjectFileXCOFF::getStorageClassForGlobal(GO); MCSectionXCOFF *Sec = Context.getXCOFFSection(S->getName(), XCOFF::XMC_PR, XCOFF::XTY_ER, - XCOFF::C_EXT, SectionKind::getMetadata()); + SC, SectionKind::getMetadata()); S->setContainingCsect(Sec); } |