[llvm] [z/OS][GOFF] Implement support for writing ESD + TXT records by the GOFFObjectWriter (PR #85851)

Neumann Hon via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 26 12:03:25 PDT 2024


================
@@ -32,3 +40,71 @@ MCStreamer *llvm::createGOFFStreamer(MCContext &Context,
     S->getAssembler().setRelaxAll(true);
   return S;
 }
+
+void MCGOFFStreamer::initSections(bool NoExecStack,
+                                  const MCSubtargetInfo &STI) {
+  MCContext &Ctx = getContext();
+  if (NoExecStack)
+    switchSection(Ctx.getAsmInfo()->getNonexecutableStackSection(Ctx));
+  else
+    switchSection(Ctx.getObjectFileInfo()->getTextSection());
+}
+
+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);
+    return;
----------------
Everybody0523 wrote:

One reason we didn't want to do that is because an SD Record, on its own, cannot own any text. (ie. the "owner" field of a TXT record cannot be the EsdId of a SD record), so in this case a section wouldn't actually be allowed to own text except indirectly through its subsections. 

https://github.com/llvm/llvm-project/pull/85851


More information about the llvm-commits mailing list