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

Ulrich Weigand via llvm-commits llvm-commits at lists.llvm.org
Tue Dec 9 02:31:04 PST 2025


================
@@ -183,17 +191,81 @@ void SystemZHLASMAsmStreamer::emitInstruction(const MCInst &Inst,
   EmitEOL();
 }
 
+static void emitXATTR(raw_ostream &OS, StringRef Name,
+                      GOFF::ESDLinkageType Linkage,
+                      GOFF::ESDExecutable Executable,
+                      GOFF::ESDBindingScope BindingScope) {
+  llvm::ListSeparator Sep(",");
+  OS << Name << " XATTR ";
+  OS << Sep << "LINKAGE(" << (Linkage == GOFF::ESD_LT_OS ? "OS" : "XPLINK")
+     << ")";
+  if (Executable != GOFF::ESD_EXE_Unspecified)
+    OS << Sep << "REFERENCE("
+       << (Executable == GOFF::ESD_EXE_CODE ? "CODE" : "DATA") << ")";
+  if (BindingScope != GOFF::ESD_BSC_Unspecified) {
+    OS << Sep << "SCOPE(";
+    switch (BindingScope) {
+    case GOFF::ESD_BSC_Section:
+      OS << "SECTION";
+      break;
+    case GOFF::ESD_BSC_Module:
+      OS << "MODULE";
+      break;
+    case GOFF::ESD_BSC_Library:
+      OS << "LIBRARY";
+      break;
+    case GOFF::ESD_BSC_ImportExport:
+      OS << "EXPORT";
+      break;
+    default:
+      break;
+    }
+    OS << ')';
+  }
+  OS << '\n';
+}
+
+static bool sameNameAsCSECT(MCSymbolGOFF *Sym) {
+  if (!Sym->isTemporary() && Sym->isDefined() && Sym->isInSection()) {
----------------
uweigand wrote:

Huh, are you certain?   If we get an absolute symbol, `isDefined` would be true but `isInSection` false.  The immediately following call to `getSection` would cause an assertion failure then:
```
  MCSection &getSection() const {
    assert(isInSection() && "Invalid accessor!");
```


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


More information about the llvm-commits mailing list