[llvm] [GOFF] Set reference to ADA (PR #179734)

Kai Nacke via llvm-commits llvm-commits at lists.llvm.org
Fri Feb 6 06:25:18 PST 2026


================
@@ -55,16 +55,20 @@ void MCGOFFStreamer::changeSection(MCSection *Section, uint32_t Subsection) {
   }
 }
 
-void MCGOFFStreamer::emitLabel(MCSymbol *Symbol, SMLoc Loc) {
+void MCGOFFStreamer::emitLabel(MCSymbol *Sym, SMLoc Loc) {
   MCSectionGOFF *Section =
       static_cast<MCSectionGOFF *>(getCurrentSectionOnly());
+  MCSymbolGOFF *Symbol = static_cast<MCSymbolGOFF *>(Sym);
   if (Section->isPR()) {
     if (Section->getBeginSymbol() == nullptr)
       Section->setBeginSymbol(Symbol);
     else
       getContext().reportError(
           Loc, "only one symbol can be defined in a PR section.");
   }
+  if (Section->getBeginSymbol() && Symbol->getCodeData() == GOFF::ESD_EXE_CODE)
+    Symbol->setADA(
+        static_cast<MCSymbolGOFF *>(Section->getBeginSymbol())->getADA());
----------------
redstar wrote:

> s there any valid case where in this scenario we either have no begin label or no ADA? 

No to both questions. A code section must have a begin label, and must have an ADA. And a label with `ESD_EXE_CODE` set must be in the code section. I'll change the test, and add an error.

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


More information about the llvm-commits mailing list