[llvm] [SystemZ][z/OS] Implement executePostLayoutBinding for GOFFObjectWriter (PR #67868)

via llvm-commits llvm-commits at lists.llvm.org
Fri Oct 6 11:14:45 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);
----------------
diggerlin wrote:

just for remind: I am not sure the logic why it need to change to the Parent Section if there is.  it looks different with other format. 

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


More information about the llvm-commits mailing list