[llvm] [SystemZ][z/OS] Implement executePostLayoutBinding for GOFFObjectWriter (PR #67868)
Neumann Hon via llvm-commits
llvm-commits at lists.llvm.org
Mon Oct 23 19:33:32 PDT 2023
================
@@ -32,3 +38,47 @@ MCStreamer *llvm::createGOFFStreamer(MCContext &Context,
S->getAssembler().setRelaxAll(true);
return S;
}
+
+void MCGOFFStreamer::initSections(bool NoExecStack,
+ const MCSubtargetInfo &STI) {
+ MCContext &Ctx = getContext();
+ switchSection(Ctx.getObjectFileInfo()->getTextSection());
+
+ if (NoExecStack)
+ switchSection(Ctx.getAsmInfo()->getNonexecutableStackSection(Ctx));
+}
+
+void MCGOFFStreamer::switchSection(MCSection *S, const MCExpr *Subsection) {
+ auto Section = cast<MCSectionGOFF>(S);
+ MCSection *Parent = Section->getParent();
+
+ if (Parent) {
+ const MCExpr *Subsection = Section->getSubsectionId();
+ assert(Subsection && "No subsection associated with child section");
+ this->MCObjectStreamer::switchSection(Parent, Subsection);
----------------
Everybody0523 wrote:
MCSectionGOFF doesn't really map to an actual section in an object file. This is because GOFF doesn't really have "Sections" like Unix does. An MCSectionGOFF is the high-level representation of something that maps to a ESD Entry of type ED or PR that owns some text. (By "owns some text", what I mean is there is an TXT Record that has that ESD Entry as its owner).
So if a Parent exists, what that means is that its not something that is allowed to own a TXT Record. Eg: `llvm/lib/MC/MCObjectFileInfo.cpp` currently has us create the PPA1Section in `MCObjectFileInfo::initGOFFMCObjectFileInfo`. But the PPA1 doesn't really "exist" from a GOFF perspective, or more precisely it isn't a record of any kind. It's just a part of its parent section. So, when the Streamer class wants to switch to a MCSectionGOFF that has a Parent, what it means is that the MCSectionGOFF in question is just a part of an existing Section that owns some text.
https://github.com/llvm/llvm-project/pull/67868
More information about the llvm-commits
mailing list