diff options
author | esmeyi <esme.yi@ibm.com> | 2023-01-11 23:27:47 -0500 |
---|---|---|
committer | esmeyi <esme.yi@ibm.com> | 2023-01-11 23:27:47 -0500 |
commit | 5ce0a26bd1cd7fb3d815fd5f03c55dcdac5482c4 (patch) | |
tree | 182becc1a5e7a9cd7a9c9eac3dde57f75abfa0ed /llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp | |
parent | 7f15907acc90284706310843b6a712641b00bf1d (diff) | |
download | llvm-5ce0a26bd1cd7fb3d815fd5f03c55dcdac5482c4.zip llvm-5ce0a26bd1cd7fb3d815fd5f03c55dcdac5482c4.tar.gz llvm-5ce0a26bd1cd7fb3d815fd5f03c55dcdac5482c4.tar.bz2 |
[XCOFF] handle the toc-data for object file generation.
Summary: The toc-data feature has been supported for assembly file generation.
This patch handles the toc-data for object file generation.
Reviewed By: shchenz
Differential Revision: https://reviews.llvm.org/D139516
Diffstat (limited to 'llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp')
-rw-r--r-- | llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp b/llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp index b2d56ad..e760564 100644 --- a/llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp +++ b/llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp @@ -2292,16 +2292,16 @@ TargetLoweringObjectFileXCOFF::getTargetSymbol(const GlobalValue *GV, // function entry point. We choose to always return a function descriptor // here. if (const GlobalObject *GO = dyn_cast<GlobalObject>(GV)) { + if (GO->isDeclarationForLinker()) + return cast<MCSectionXCOFF>(getSectionForExternalReference(GO, TM)) + ->getQualNameSymbol(); + if (const GlobalVariable *GVar = dyn_cast<GlobalVariable>(GV)) if (GVar->hasAttribute("toc-data")) return cast<MCSectionXCOFF>( SectionForGlobal(GVar, SectionKind::getData(), TM)) ->getQualNameSymbol(); - if (GO->isDeclarationForLinker()) - return cast<MCSectionXCOFF>(getSectionForExternalReference(GO, TM)) - ->getQualNameSymbol(); - SectionKind GOKind = getKindForGlobal(GO, TM); if (GOKind.isText()) return cast<MCSectionXCOFF>( @@ -2360,6 +2360,10 @@ MCSection *TargetLoweringObjectFileXCOFF::getSectionForExternalReference( if (GO->isThreadLocal()) SMC = XCOFF::XMC_UL; + if (const GlobalVariable *GVar = dyn_cast<GlobalVariable>(GO)) + if (GVar->hasAttribute("toc-data")) + SMC = XCOFF::XMC_TD; + // Externals go into a csect of type ER. return getContext().getXCOFFSection( Name, SectionKind::getMetadata(), |