diff options
| author | jasonliu <jasonliu.development@gmail.com> | 2019-11-25 15:02:01 +0000 |
|---|---|---|
| committer | jasonliu <jasonliu.development@gmail.com> | 2019-11-25 15:02:01 +0000 |
| commit | 906ecae2ed8b14924236a02ffa7fc7142c5b9753 (patch) | |
| tree | a4e3414d20fa6794841d4c1a33a5f0bfbcf4ffbc /llvm/lib/Target/PowerPC | |
| parent | d1782133d96d316c3bc98e33a191994794a26851 (diff) | |
| download | bcm5719-llvm-906ecae2ed8b14924236a02ffa7fc7142c5b9753.tar.gz bcm5719-llvm-906ecae2ed8b14924236a02ffa7fc7142c5b9753.zip | |
[AIX][XCOFF] Generate undefined symbol in symbol table for external function call
Summary:
This patch sets up the infrastructure for
1. Associate MCSymbolXCOFF with an MCSectionXCOFF when it could not
get implicitly associated.
2. Generate undefined symbols. The patch itself generates undefined symbol
for external function call only. Generate undefined symbol for external
global variable and external function descriptors will be handled in
separate patch(s) after this is land.
Differential Revision: https://reviews.llvm.org/D70443
Diffstat (limited to 'llvm/lib/Target/PowerPC')
| -rw-r--r-- | llvm/lib/Target/PowerPC/PPCISelLowering.cpp | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/llvm/lib/Target/PowerPC/PPCISelLowering.cpp b/llvm/lib/Target/PowerPC/PPCISelLowering.cpp index 4d9288ce798..ff704b7299a 100644 --- a/llvm/lib/Target/PowerPC/PPCISelLowering.cpp +++ b/llvm/lib/Target/PowerPC/PPCISelLowering.cpp @@ -5325,8 +5325,20 @@ SDValue PPCTargetLowering::FinishCall( // C-linkage name. GlobalAddressSDNode *G = cast<GlobalAddressSDNode>(Callee); auto &Context = DAG.getMachineFunction().getMMI().getContext(); - MCSymbol *S = Context.getOrCreateSymbol(Twine(".") + - Twine(G->getGlobal()->getName())); + + 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. + MCSectionXCOFF *Sec = + Context.getXCOFFSection(S->getName(), XCOFF::XMC_PR, XCOFF::XTY_ER, + XCOFF::C_EXT, SectionKind::getMetadata()); + S->setContainingCsect(Sec); + } + Callee = DAG.getMCSymbol(S, PtrVT); // Replace the GlobalAddressSDNode Callee with the MCSymbolSDNode. Ops[1] = Callee; |

