[llvm] [SystemZ][GOFF] Reference to external variable needs PR symbol (PR #185742)

Kai Nacke via llvm-commits llvm-commits at lists.llvm.org
Fri Apr 10 08:21:14 PDT 2026


================
@@ -1232,6 +1232,21 @@ void SystemZAsmPrinter::emitEndOfAsmFile(Module &M) {
   emitAttributes(M);
 }
 
+void SystemZAsmPrinter::emitExternalGlobalVariableEnd(MCSymbol *Sym) {
+  auto TT = OutContext.getTargetTriple();
+  if (TT.isOSzOS()) {
+    // On z/OS, we need to associate an external data reference with an ED
+    // symbol, for which we use the the ED of the ADA. We also need to mark the
+    // reference as being to data, otherwise we cannot bind with code generated
+    // by XL.
+    MCSymbolGOFF *EmittedSym = static_cast<MCSymbolGOFF *>(Sym);
+    EmittedSym->setADA(static_cast<MCSectionGOFF *>(
+                           OutContext.getObjectFileInfo()->getADASection())
+                           ->getParent());
----------------
redstar wrote:

Good point, I use `emitADA()` now and updated the GOFF writer.

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


More information about the llvm-commits mailing list