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

Kai Nacke via llvm-commits llvm-commits at lists.llvm.org
Fri Dec 5 11:54:00 PST 2025


================
@@ -2937,6 +2937,21 @@ bool AsmPrinter::doFinalization(Module &M) {
     }
   }
 
+  // Emit symbol attributes for declarations (GOFF only).
+  if (TM.getTargetTriple().isOSBinFormatGOFF()) {
+    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_ELF_TypeFunction
+                                                  : MCSA_ELF_TypeObject);
----------------
redstar wrote:

Same problem as above: those type information is not emitted for external references.
However, the binder matches a symbol and a reference when either one of them has no code/data specified, or if both have the same code/data type. Which means that leaving the code/data field as unspecified works. I tested this with Open XL. As result, I just removed the code.

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


More information about the llvm-commits mailing list