[llvm-branch-commits] [llvm] [SystemZ] Implement ctor/dtor emission via @@SQINIT and .xtor sections (PR #171476)
Amy Kwan via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Tue Jan 6 11:41:41 PST 2026
================
@@ -1016,6 +1021,59 @@ void SystemZAsmPrinter::emitMachineConstantPoolValue(
OutStreamer->emitValue(Expr, Size);
}
+// Emit the ctor or dtor list taking into account the init priority.
+void SystemZAsmPrinter::emitXXStructorList(const DataLayout &DL,
+ const Constant *List, bool IsCtor) {
+ if (!TM.getTargetTriple().isOSBinFormatGOFF())
+ return AsmPrinter::emitXXStructorList(DL, List, IsCtor);
+
+ SmallVector<Structor, 8> Structors;
+ preprocessXXStructorList(DL, List, Structors);
+ if (Structors.empty())
+ return;
+
+ const Align Align = llvm::Align(4);
+ const TargetLoweringObjectFile &Obj = getObjFileLowering();
+ for (Structor &S : Structors) {
+ MCSection *OutputSection =
+ (IsCtor ? Obj.getStaticCtorSection(S.Priority, nullptr)
+ : Obj.getStaticDtorSection(S.Priority, nullptr));
+ OutStreamer->switchSection(OutputSection);
----------------
amy-kwan wrote:
```suggestion
MCSectionGOFF *Section = static_cast<MCSectionGOFF *>
(IsCtor ? Obj.getStaticCtorSection(S.Priority, nullptr)
: Obj.getStaticDtorSection(S.Priority, nullptr));
OutStreamer->switchSection(Section);
```
https://github.com/llvm/llvm-project/pull/171476
More information about the llvm-branch-commits
mailing list