[llvm-branch-commits] [llvm] [GOFF] Add writing of section symbols (PR #133799)

Ulrich Weigand via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Mon Apr 7 14:07:13 PDT 2025


================
@@ -239,6 +298,63 @@ class GOFFWriter {
 GOFFWriter::GOFFWriter(raw_pwrite_stream &OS, MCAssembler &Asm)
     : OS(OS), Asm(Asm) {}
 
+void GOFFWriter::defineSectionSymbols(const MCSectionGOFF &Section) {
+  if (Section.isSD()) {
+    GOFFSymbol SD(Section.getName(), Section.getId(),
+                  Section.getSDAttributes());
+    writeSymbol(SD);
+  }
+
+  if (Section.isED()) {
+    GOFFSymbol ED(Section.getName(), Section.getId(),
+                  Section.getParent()->getId(), Section.getEDAttributes());
+    if (Section.requiresLength())
+      ED.SectionLength = Asm.getSectionAddressSize(Section);
+    writeSymbol(ED);
+  }
+
+  if (Section.isPR()) {
+    GOFFSymbol PR(Section.getName(), Section.getId(),
+                  Section.getParent()->getId(), Section.getPRAttributes());
+    PR.SectionLength = Asm.getSectionAddressSize(Section);
+    if (Section.requiresNonZeroLength()) {
----------------
uweigand wrote:

But if you do call an external function, don't you then have to have actual data in the ADA identifying that external function?   I.e. don't those places that require a non-null ADA also automatically imply there are contents?

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


More information about the llvm-branch-commits mailing list