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

Fangrui Song via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Wed Jun 18 22:25:53 PDT 2025


================
@@ -41,6 +44,61 @@ void MCGOFFStreamer::changeSection(MCSection *Section, uint32_t Subsection) {
   MCObjectStreamer::changeSection(Section, Subsection);
 }
 
+void MCGOFFStreamer::emitLabel(MCSymbol *Symbol, SMLoc Loc) {
+  MCObjectStreamer::emitLabel(Symbol, Loc);
+  cast<MCSymbolGOFF>(Symbol)->initAttributes();
+}
+
+bool MCGOFFStreamer::emitSymbolAttribute(MCSymbol *Sym,
+                                         MCSymbolAttr Attribute) {
+  auto *Symbol = cast<MCSymbolGOFF>(Sym);
+  switch (Attribute) {
+  case MCSA_Invalid:
+  case MCSA_Cold:
+  case MCSA_ELF_TypeFunction:
+  case MCSA_ELF_TypeIndFunction:
+  case MCSA_ELF_TypeObject:
+  case MCSA_ELF_TypeTLS:
+  case MCSA_ELF_TypeCommon:
+  case MCSA_ELF_TypeNoType:
+  case MCSA_ELF_TypeGnuUniqueObject:
+  case MCSA_LGlobal:
+  case MCSA_Extern:
+  case MCSA_Exported:
+  case MCSA_IndirectSymbol:
+  case MCSA_Internal:
+  case MCSA_LazyReference:
+  case MCSA_NoDeadStrip:
+  case MCSA_SymbolResolver:
+  case MCSA_AltEntry:
+  case MCSA_PrivateExtern:
+  case MCSA_Protected:
+  case MCSA_Reference:
+  case MCSA_WeakDefinition:
+  case MCSA_WeakDefAutoPrivate:
+  case MCSA_WeakAntiDep:
+  case MCSA_Memtag:
+    return false;
+
+  case MCSA_Global:
+    Symbol->setExternal(true);
+    break;
+  case MCSA_Local:
+    Symbol->setExternal(false);
----------------
MaskRay wrote:

Is local/global/weak tested?

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


More information about the llvm-branch-commits mailing list