[llvm] [GOFF] Emit symbols for functions. (PR #144437)

Kai Nacke via llvm-commits llvm-commits at lists.llvm.org
Fri Nov 28 11:47:26 PST 2025


================
@@ -1112,6 +1113,23 @@ void SystemZAsmPrinter::emitEndOfAsmFile(Module &M) {
   if (TT.isOSzOS()) {
     emitADASection();
     emitIDRLSection(M);
+    // Emit EXTRN declarations.
+    OutStreamer->pushSection();
+    for (auto &GO : M.global_objects()) {
+      if (GO.isDeclaration()) {
+        MCSymbol *Sym = TM.getSymbol(&GO);
+        OutStreamer->emitSymbolAttribute(Sym, GO.hasExternalWeakLinkage()
+                                                  ? MCSA_WeakReference
+                                                  : MCSA_Global);
+        OutStreamer->emitSymbolAttribute(Sym, isa<Function>(GO) ? MCSA_Code
+                                                                : MCSA_Data);
+      }
+    }
+    OutStreamer->switchSection(
+        static_cast<MCSectionGOFF *>(getObjFileLowering().getTextSection())
+            ->getParent());
----------------
redstar wrote:

The ownership is only needed for the object path. I sank the RootSD into the GOFF writer, which makes the section switch unnecessary.

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


More information about the llvm-commits mailing list